and it is working with a join to Category or without a join ? 2010/1/12 Chris Nicola <[email protected]>
> Yes but why would you combine Session.Load<T>() with Session.Linq<T>. > Unless the linq provider has changed significantly I don't ever remember > seeing that. I will typically write something like: > > Session.Linq<T>().Where(e => e.Category.Id = categoryid); > > Easier to read and will still result in only a single query to the > database. I do know that the above code works in the older linq provider > because I use it often. > > Chris > > On Mon, Jan 11, 2010 at 5:35 PM, Mohamed Meligy <[email protected]>wrote: > >> I don't fully remember but I don't think so. >> You know, Session.Load<>() method was introduced to make this kind of >> FK-PK mentioning more OOP-like. >> It does not load the object unless you try to get the value of other >> properties than the ID, not when you use it in LINQ expression tree or get >> the value of the ID, so, it should not be more expensive than the other way. >> >> >> Regards, >> >> -- >> Mohamed Meligy >> Senior Developer, Team Lead Backup (.Net Technologies - TDG - >> Applications) >> Injazat Data Systems >> P.O. Box: 8230 Abu Dhabi, UAE. >> >> Phone: +971 2 6992700 >> Direct: +971 2 4045385 >> Mobile: +971 50 2623624, +971 55 2017 621 >> >> E-mail: [email protected] >> Weblog: http://weblogs.asp.net/meligy >> >> >> On Tue, Jan 12, 2010 at 5:05 AM, Chris Nicola <[email protected]> wrote: >> >>> I would expect .Where(p => p.Category.Id == id) to work, but I haven't >>> started using the new provider yet. >>> >>> Is there somewhere that the new linq provider is being documented. I >>> would like to get some idea of where it differs from Oren's. "It's >>> documented in the code" is a valid answer if that is the only place, I am >>> just curious if it is discussed anywhere else. >>> >>> Thanks, >>> Chris >>> >>> On Mon, Jan 11, 2010 at 4:32 PM, Tuna Toksoz <[email protected]> wrote: >>> >>>> >>>> .Where (p => p.Category.Id <http://p.category.id/> == categoryId) >>>> >>>> Doesn't this work? >>>> >>>> >>>> Tuna Toksöz >>>> Eternal sunshine of the open source mind. >>>> >>>> http://devlicio.us/blogs/tuna_toksoz >>>> http://tunatoksoz.com >>>> http://twitter.com/tehlike >>>> >>>> >>>> >>>> >>>> On Mon, Jan 11, 2010 at 10:34 PM, ulu <[email protected]> wrote: >>>> >>>>> Hi, >>>>> >>>>> What is the recommended way of using the new Linq provider? I'm using >>>>> the trunk version and trying to do a simple thing: fetch entities by a >>>>> foreign key. >>>>> >>>>> So, I've got the Product class and it has the Category property. How >>>>> do I fetch all products given a categoryId? >>>>> .Where (p => p.Category.Id == categoryId) >>>>> or >>>>> .Where (p => p.Category == session.Load<Category>(categoryId) >>>>> ? >>>>> >>>>> Thanks >>>>> >>>>> ulu >>>>> >>>>> -- >>>>> 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]<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]<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]<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]<nhusers%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/nhusers?hl=en. > > -- Fabio Maulo--
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.
