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 :)
Vladan
On 2 velj, 14:55, "allan.ritc...@gmail.com" <allan.ritc...@gmail.com>
wrote:
> http://stackoverflow.com/questions/286721/json-net-and-nhibernate-laz...
Alternatively, you can write code that will manually build the JSON
that you need if the previous method fails. See Reading and Writing
JSON on http://james.newtonking.com/projects/json/help/
-Robert Eberhart
On Feb 2, 6:16 am, Vladan Strigo <vladan.str...@gmail.com> wrote:
DaBudhaMan...this is exactly what I need...thanks sooo much!
Interestly I've digged through the code today and found the value
provider, however my mind just didn't see that as an option...I've
just looked in other places to add that same logic...thanks so much
for the heads up!
Ill post the code when I am done! :)
Vladan