0

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?

marcelo-ferraz
  • 3,147
  • 4
  • 38
  • 55
  • Are you certain that size is the reason you can't transmit the lists? I've seen others have trouble with nHibernate because it uses the `IList` interface for lists. – John Saunders Jul 30 '09 at 00:01

2 Answers2

1

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.

Community
  • 1
  • 1
sirrocco
  • 7,975
  • 4
  • 59
  • 81
0

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

marcelo-ferraz
  • 3,147
  • 4
  • 38
  • 55