If you have HasMany (StoreZoneStyles) in your StoreZone you could call it like this:
from storeZones in session.Linq<StoreZone>() from storeZoneStyles in storeZones.StoreZoneStyles // Depending on how did you call it in StoreZone Class where storeZones.StoreCode == storeCode select storeZoneStyles; But I wouldn't use Linq here because it can give you messy SQL, since join is not implemented, I would suggest you a Criteria or HQL. I suggest you to go to the Nhibernate.Tests.Linq where you can find many samples how to use NHibernate.Linq. http://nhibernate.svn.sourceforge.net/viewvc/nhibernate/trunk/nhibernate/src/NHibernate.Test/Linq/LinqQuerySamples.cs?revision=4800&view=markup Hope it helps! Kornelije Sajler On Tue, Nov 3, 2009 at 15:14, sk <[email protected]> wrote: > > Anybody? > > On Nov 2, 2:23 pm, sk <[email protected]> wrote: > > I am using linq-to-nhibernate with the following query: > > > > ISession session = GetSession(); > > var query = from storeZoneStyles in session.Linq<StoreZoneStyle>() > > from storeZones in session.Linq<StoreZone>() > > where storeZoneStyles.StoreZoneId == storeZones.StoreZoneId && > > storeZones.StoreCode == storeCode > > select storeZoneStyles; > > > > session.Close(); > > > > With this query, I only want to get all storeZoneStyles that belong to > > a storecode. Now when I run this I get the following run-time > > exception: > > > > Unable to cast object of type > > 'System.Linq.Expressions.ConstantExpression' to type > > 'System.Linq.Expressions.LambdaExpression'. > > > > Can somebody help me out please? > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
