http://stackoverflow.com/questions/286721/json-net-and-nhibernate-lazy-loading-of-collections


On Feb 2, 6:16 am, Vladan Strigo <[email protected]> wrote:
> I have a small problem while serializing an Entity to Json.
>
> Lets say that we have a model: Customer <-> Product, so Customer has
> Product propery, Product has Customers collection property....it comes
> down to Customer.Product.Customers.
>
> I eagerly load Customer and his Product, but when sending it to
> Serializer (Json.Net), it accesses Customers property of Product, and
> thus triggers the lazy load to db.
>
> Is there a way to stop lazy load from occuring...and in this case I
> don't want to:
>
> a) not map this side of relationship
> b) make another model like a viewmodel which is simpler
> c) not eagerly fetch the Customers property because in fact I don't
> need it.
>
> Is there a way to stop lazy load while querying?!
>
> Thanks!
> Vladan
>
> @Fabio: this is the last part to make serialization work as expected,
> when it does Ill post up the code to serialize Entity to Json using
> Json.Net :)

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to