I'm also using WCF to do exactly the same thing as you are doing. i don't have any problems with sending the objects with lazy loading back to the client app. I'm also working with datacontracs and datamembers so you shouldn't have a problem with it. of course when you do a lazy loading and you try to use the collection in the client app, you'll get an error so be aware of that.
my structure is the same as you have. on a Get i want to load everything (the complete object with all it's associations), on load of a list, no collections. i had to set the lazy = true on the collection bags because when setting them to lazy = false, and trying to change the fetchmode to lazy, it was still fetching them. (lazy seems to be deprecated in NH 2.0?) the lazy loading is working, but when i set the fetchmode to Join before getting the object with all it's associations, i'm getting problems with the join.. Since i have 4 collections in one object, the join is giving me duplicate items in several collections, because let's say when you have one collection with 2 items, the other collections will have one item double. some guys were talking about crit.SetResultTransformer(new RootEntityResultTransformer());, but that isn't doing anything for me. I'm still getting collections with duplicate items in there. maybe that helps you a bit, and maybe someone can now answer my question of how to solve my problem :) On 8 apr, 07:45, Fethi Gürcan <[email protected]> wrote: > Hello James, > > My question is not point that. But i decided to use DTO's all scnarios like > that. > > Anyway, your answer also useful for me. > > Thanks > > 2009/4/4 James Hicks <[email protected]> > > > > > I guess I am not following what you are asking. The fetch strategy allows > > you to specify how to pull up related entities like using eager or lazy > > loading. You can tell NHibernate how far down the hierarchy to traverse. I > > think the default is 3 but you should check on that. > > > James Hicks > > > 2009/4/3 Fethi Gürcan <[email protected]> > > > Thanks. But there is no any fetch strategies that says "do not fetch", that > >> i see. > > >> We are using fetch strategy to define when/how the assosication fecthed. > > >> Right? > > >> 2009/4/3 James Hicks <[email protected]> > > >> Fetch strategy > > >>>http://nhforge.org/doc/nh/en/index.html#performance-fetching > > >>> James > > >>> 2009/4/2 Fethi Gürcan <[email protected]> > > >>> Hello, > > >>>> I have entities with parent-child hierarchy, > > >>>> yes, i can set lazy=true , lazy=false for setting behaviour of loading > >>>> children. > > >>>> So, i need to pass data to client-side via WCF. > > >>>> As you know, when i marked child-relation as [DataMember] like the other > >>>> properties. > >>>> The WCF will serialize the whole properties that marked as [DataMember]. > >>>> Serialization process calls the all properties so the properties will be > >>>> loaded. And that does not differs lazy=true or lazy=false. > > >>>> Actually i'll use Entity classes for two different cases > > >>>> 1) Internal use in business layer. (there is no problem here) > >>>> 2) Passing data to client-side. (I'll use DTOs in some cases but not > >>>> everytime) > > >>>> In the case 2, there ares some simple scenarios; > > >>>> a) When i get the whole record in a table, i don't want to pass > >>>> the children. > >>>> b) When i get the single record. I want to get the children. > >>>> (Actually, all child have a relation to parent. i dont need to pass that > >>>> also) > > >>>> Is there any way to tell NHibernate (in runtime) to do load children or > >>>> do not? > > >>>> Thanks. > >>>> -- > >>>> Fethi Gürcan > > >> -- > >> Fethi Gürcan > > -- > Fethi Gürcan --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
