I've got a web service (via WCF) that returns entities retrieved via
NHibernate to the client. To simplify integration, I've added some
scaffolding code that automatically starts a session when WCF receives a
request and closes it when the request returns.
This has the (desired) side effect of bombing out early if my web
service returns an entity that would lazy-load additional properties
upon serialization (desired because this would present a performance
issue, cause more data to be transmitted than I was expecting and in
case of circular references lead to a stack overflow or oom situation).
Is there a way to disconnect an entity from the NHibernate ISession so
that accessing a normally lazy-loaded reference property simply returns
null?
I tried ISession.Evict(), but it still throws an exception if I access a
lazy-loaded property of my entity after closing the session.
-Markus-
Brandon Law
> --
> You received this message because you are subscribed to the Google Groups "nhusers" group.
--
You received this message because you are subscribed to the Google Groups "nhusers" group.
Maybe, but why introduce that complexity? by mapping the domain object to a context specific dto you know if the value is present or not because it was populated before it was sent across the wire. Not to mention the receiver shouldn't have any knowledge of NH.
--
You received this message because you are subscribed to the Google Groups "nhusers" group.
To view this discussion on the web visit https://groups.google.com/d/msg/nhusers/-/j7FYrrN522YJ.