Well I guess I need to different object types in this scenario. Thanks for the guideing.
On Oct 31, 1:35 pm, Mohamed Meligy <[email protected]> wrote: > For NHibernate, I don't "think" it has any way of "never load this property" > kind of thing, unless you are doing projection of course. > > You can mark the properties to be ignored by WCF (IgnoreDataMemberAttribute > on each I think). Of course this will work if you know you "never" want to > include those properties in WCF results. > > One other ugly way of doing it is setting the properties to null by code > before serialization. > > One other way may be creating an interface that includes just the properties > that you want included in the WCF result and make that the return type of > the WCF service method. Not sure if this will work though. > > *Mohamed Meligy > *Readify | Senior Developer > > M:+61 451 835006 | W:www.readify.net > [image: Description: Description: Description: Description: rss_16] [image: > Description: Description: Description: Description: > cid:[email protected]] > <http://www.linkedin.com/in/meligy> [image: > Description: Description: Description: Description: > cid:[email protected]] <http://twitter.com/meligy> > <http://www.greatplacetowork.com.au/best/best-companies-australia.php><http://www.readify.net/AboutUs/NewsItem.aspx?id=10> > > On Thu, Oct 28, 2010 at 4:05 PM, Peter Hageus <[email protected]>wrote: > > > You could use a projection that maps back to the entity, setting the > > lists to null. Not an ideal solution though, as you are effectively > > working against the tool. > > > There might be some solution using a stateless session, but I haven't > > got QueryOver working against that in the NHIbernate version I use... > > > /Peter > > > On 27 Okt, 14:01, Niclas Pehrsson <[email protected]> wrote: > > > I agree with the author of that post > > > > "Some people dislike the idea of sending the 'real' domain objects > > > across the wire. Instead they create DTO objects for everything that > > > has to be passed back from a service. > > > > My personal preference is to only create DTO classes when they are > > > needed, hopefully saving time on creating both the DTO objects and the > > > code to map my domain properties to them." > > > > And we are keeping our domain model to not get deep or many > > > associations. > > > For example our Invoice object just got references to its orderlines > > > and actions. > > > And in this case I only want to load about 50 invoices without the > > > list of orderlines and actions. > > > And when I need to look or edit the invoice I will load the whole one. > > > But I'm not using any mapper in this case, I use the domain invoice > > > class. Cause all the logic I have on the server I want on my > > > silverlight client. > > > > Everything is working out fine except I can't tell nhibernate to not > > > bother about the orderlines and actions. (actions is a list with > > > actions that have happened to the invoice). > > > So have can I tell Nhibernate to skip these to collections in the > > > easiest way? :) > > > > On Oct 27, 10:44 am, "Richard Brown \(gmail\)" > > > > <[email protected]> wrote: > > > > You would still need to make a transient copy of your entities (don't > > modify > > > > the persistent ones). > > > > > Again, AutoMapper might be able to help ... or perhaps a little utility > > > > class to extract-and-copy a portion of your model: > > > > >http://broloco.blogspot.com/2009/02/sending-domain-objects-across-wir. > > .. > > > > > -----Original Message----- > > > > From: Niclas Pehrsson > > > > Sent: Wednesday, October 27, 2010 8:22 AM > > > > To: nhusers > > > > Subject: [nhusers] Re: QueryOver and Fetch > > > > > Well, I have read it, and I can't see why I just can't get an. > > > > > No it is not possible that way. > > > > Yes it is possible, you have to do like this...... > > > > > On Oct 26, 8:07 pm, Carlos cubas <[email protected]> wrote: > > > > > 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-m... > > > > > > -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.aspxan.... > > .. > > > > > > > < > >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]> > > <nhusers%[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]<nhusers%[email protected]> > > . > > > > > > For more options, visit this group > > > > > athttp://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]<nhusers%[email protected]> > > . > > > > > > For more options, visit this group > > > > > athttp://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]<nhusers%[email protected]> > > . > > > > For more options, visit this group athttp:// > > groups.google.com/group/nhusers?hl=en.- Dölj citerad text - > > > > - Visa citerad text - > > > -- > > 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. -- 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.
