Can anyone give me an idea on where to go with this?
On Sep 17, 9:33 am, Scott <[email protected]> wrote: > I'm using version 2.1.2 with .NET 3.5 I was under the impression that > v3 is still beta. > > The structure gets pretty big, that's why I tried to make it more > generic and simple and I think if I could figure out how to get the > intersection of two collections of any type (many-to-many, one-to- > many, etc) its just a matter of repeating it down my tree. > > Here's an example of a situation: > I have a BaseGroup which contains Specialties and Members, Specialties > have Measurements assigned to them. The Members are Scored by the > Measurements. I'm trying to get a list of all the Scores where the > BaseGroup Specialties and the BaseGroup Members intersect. > > The hbm.xml: > > <class name="Models.BaseGroup, Project" table="BaseGroup"> > <id name="RefId" type="guid"> > <generator class="guid.comb" /> > </id> > <version name="Version" type="Int32" generated="never"> > <column name="Version" not-null="true" /> > </version> > <property name="Title" column="Title" type="string" not-null="true" / > > > > <bag name="Specialties" lazy="true" table="BaseGroupSpecialty"> > <key column="BaseGroupRefId" /> > <many-to-many column="SpecialtyRefId" class="Models.Specialty, > Project" order-by="Title" /> > </bag> > > <bag name="Members" lazy="true" table="BaseGroupMember"> > <key column="BaseGroupRefId" /> > <many-to-many column="MemberRefId" class="Models.Member, Project" > order-by="Title" /> > </bag> > </class> > > <class name="Models.Specialty, Project" table="Specialty"> > <!--omitted RefId and version, all same as BaseGroup--> > <property name="Title" column="Title" type="string" not-null="true" / > > > > <bag name="BaseGroups" lazy="true" table="BaseGroupSpecialty"> > <key column="SpecialtyRefId" /> > <many-to-many column="BaseGroupRefId" class="Models.BaseGroup, > Project" order-by="Title" /> > </bag> > > <bag name="Measurements" lazy="true" table="MeasurementSpecialty"> > <key column="SpecialtyRefId" /> > <many-to-many column="MeasurementRefId" class="Models.Measurement, > Project" order-by="Title" /> > </bag> > </class> > > <class name="Models.Measurement, Project" table="Measurement"> > <!--omitted RefId and version, all same as BaseGroup--> > <property name="Title" column="Title" type="string" not-null="true" / > > > > <bag name="Specialties" lazy="true" table="MeasurementSpecialty"> > <key column="MeasurementRefId" /> > <many-to-many column="SpecialtyRefId" class="Models.Measurement, > Project" order-by="Title" /> > </bag> > </class> > > <class name="Models.Member, Project" table="Member"> > <!--omitted RefId and version, all same as BaseGroup--> > <property name="Title" column="Title" type="string" not-null="true" / > > > > <bag name="BaseGroups" lazy="true" table="BaseGroupMember"> > <key column="MemberRefId" /> > <many-to-many column="BaseGroupRefId" class="Models.BaseGroup, > Project" order-by="Title" /> > </bag> > > <bag name="Scores" lazy="true"> > <key column="MemberRefId" /> > <one-to-many class="Models.Score, Project" /> > </bag> > </class> > > <class name="Models.Scorer, Project" table="Score"> > <!--omitted RefId and version, all same as BaseGroup--> > <property name="Value" column="Value" type="double" not- > null="false" /> > > <many-to-one name="Measurement" column="MeasurementRefId" > class="Models.Measurement, Project" not-null="true" /> > <many-to-one name="Member" column="MemberRefId" class="Member, > Project" not-null="true" /> > </class> > > On Sep 17, 2:02 am, nadav s <[email protected]> wrote: > > > > > what version are you using? (looks like the old one and not v3?) > > what is you're actual scenario (with objects and associations that make > > sense)? > > > On Thu, Sep 16, 2010 at 10:09 PM, Scott <[email protected]> wrote: > > > I'm new to Linq and one thing I'm not understanding is how to form > > > queries based on nhibernate objects that have collections and I need > > > to get down the tree on them. > > > > Obj1.Bags.AnyObjInBag.MoreBags.AnyObjInBag > > > > Maybe I'm doing it completely wrong but the only thing that some what > > > works on NH collections is if I do a cast on it like: > > > > from O1 in NHObj.O1Bag.Cast<O1Type>() > > > join O2 in NHSession.Linq<O2>() on O1 equals O2.O1Reference > > > select O2 > > > > That works for a collection to a single parameter but what about the > > > intersection of 2 collections? > > > > In TSQL I would have just had a bunch of inner joins until I got > > > everything I wanted. > > > > -- > > > 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.
