views:

64

answers:

2

I am using WCF for my project and i need to transit some entities through it.

The thing is that some of them have lists inside, with an enormeous ammount of items, and so forth, i cannot pass it through WCF, given its size.

How can I, through code, not load a given property from the database, but load all the rest?

+1  A: 

By default the NH lists are lazy loaded - so unless you specified otherwise, the list will not be loaded.

However , the property will be an IProxy..something that won't be serializable. If you want you can probably set an [XmlIgnore] or [NotSerializable] (not sure how it's sent over wcf) on that specific property.

Having said that - do prefer using a DTO instead of sending your entity over the wire. See this for more about why you shouldn't send the entity.

sirrocco
I was going to give up... but you know what? I am gonna deal with their shenanigans! Even if it kills me!
NoProblemBabe
A: 

Actually due to sirrocco I've endured myself. I a friend of mine helped me to finding this:

http://www.junasoftware.com/blog/nhibernate-setresulttransformer-and-dto.aspx

NoProblemBabe
and this: http://blog.hibernate.org/Bloggers/Everyone/Year/2006/Month/03/Day/17
NoProblemBabe