Same advice from me. Kind of reminds me of this blog post by Ayende. http://ayende.com/Blog/archive/2010/08/29/i-ainrsquot-going-against-my-professional-judgment-pro-bono.aspx
-Carlos Practice makes perfect, but if no one is perfect, why practice? Date: Tue, 26 Oct 2010 13:54:06 -0400 Subject: Re: [nhusers] Re: QueryOver and Fetch From: [email protected] To: [email protected] the best practice is to use a DTO. Using a connected db object in WCF is not a good practice and will end up causing significant problems. I recommend you rethink your db and transfer strategies. John Davidson On Tue, Oct 26, 2010 at 10:39 AM, Niclas Pehrsson <[email protected]> wrote: Well I don't want to use DTO's I'm looking for an solution where I can query the database with NHibernate and to not load an associated list at all. We have thought about DTO's but we want it to work this way. Any solutions? On Oct 26, 2:49 pm, Alessandro Ghidini <[email protected]> wrote: > Hi Niclas, > I think that you're trying to solve the issue from the wrong perspective. > You want to stop NH to load a collection because you don't want to expose > that collection through the WCF service. In my opinion you should change the > object returned by the WCF to a new object which does not contain the > collection at all (using some sort of DTO). > > I agree with you: Who am I to suggest it? You're right.. :) > This is the reason why I'm going to point you to these > addresses:http://ayende.com/Blog/archive/2009/05/14/the-stripper-pattern.aspxandhttp://ayende.com/Blog/archive/2010/08/04/nhibernate-is-lazy-just-liv... > > <http://ayende.com/Blog/archive/2009/05/14/the-stripper-pattern.aspx>To > Ayende: for finding out those posts i googled for "ayende strip club".. Pls, > do not have bad thoughts when you'll watch your blog statistics about google > search keys! :) > > > > On Tue, Oct 26, 2010 at 10:18, Niclas Pehrsson <[email protected]> wrote: > > Im looking for a method to use QueryOver and tell it to not load an > > associated list on my entity. > > > The options are > > Default > > Eager > > Lazy > > > I want the result from lazy but I'm working with wcf services and when > > serializing it will load the associated list anyway. Are there some > > way there I can tell it to never load the list. Like just skip loading > > it? > > > I know I can do it by change my mapping and have different entitynames > > but I'm looking for a more simple approach. > > > -- > > 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]<nhusers%[email protected]> > > . > > For more options, visit this group at > >http://groups.google.com/group/nhusers?hl=en. > > -- > Alessandro Ghidini -- 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. -- 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. -- 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.
