Hmm, I apologize I don't think I can help much. I have not worked with ISet<T> which comes from Iesi.Collections. It is possible it isn't supported in Linq2NH, it also possible ISet<T> is not compatible with IQueryable implementations. Not sure though. You could go through the tests for Linq2NH and see if there are any tests that use ISet<T>. If there aren't you could write one and submit it as a failing test for ISet<T> collections.
Alternatively if you are not married to using <set> try using <list> or <bag>. I use <bag> personally. I have read some threads about performance issues where nHibernate has to delete and re-add the entire collection for any changes with bags but I have never run into that problem. Perhaps because the entities in my bag have their own surrogate keys so they are always considered unique. Maybe that just isn't a problem anymore. Either way I have found <bag> to be an efficient collection for two-way many-to-one mappings (of collections as large as over 1000) and I would recommend it. Chris On Thu, Aug 13, 2009 at 1:34 AM, Ricardo Peres <[email protected]> wrote: > > Hello, > > Thanks for your help. Children is ISet<SomeClass>, which is mapped as > a <set>. I have experimented both with Count and with Count(), but no > luck. > I am using the latest versions of NHibernate (2.1.0) and LINQ to > NHibernate (1.0). > > Here is the class: > > public class SomeClass > { > public virtual Int32 Id { get; private set; } > public virtual SomeClass Parent { get; set; } > public virtual ISet<SomeClass> Children { get; private set; } > } > > And here is the mapping: > > <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" > assembly="NHibernateTest" auto-import="true" default- > access="property"> > <class name="SomeClass" table="`SOME_TABLE`"> > <id name="Id" column="`ID`"> > <generator class="identity"/> > </id> > <many-to-one name="Parent" class="SomeClass" column="`PARENT`"/> > <set name="Children" inverse="true" cascade="all" outer- > join="true"> > <key column="`PARENT`" foreign-key="`ID`"/> > <one-to-many class="SomeClass"/> > </set> > </class> > </hibernate-mapping> > > > On Aug 12, 6:13 pm, Tuna Toksoz <[email protected]> wrote: > > what is the type of Children? IList or IList<child>? > > > > Tuna Toksöz > > Eternal sunshine of the open source mind. > > > > > http://devlicio.us/blogs/tuna_toksozhttp://tunatoksoz.comhttp://twitter.com/tehlike > > > > > > > > On Wed, Aug 12, 2009 at 12:57 PM, Ricardo Peres <[email protected]> > wrote: > > > > > Hi, > > > > > I have made this answer days ago, but no one answered... Here I go > > > again. I can't run this query: > > > > > var lll = (from l in session.Linq<SomeClass>() > > > where > l.Children.Count > > > > 0 > > > select l).ToList(); > > > > > If I use Any, it works: > > > > > var lll = (from l in session.Linq<SomeClass>() > > > where > l.Children.Any() == > > > true > > > select l).ToList(); > > > > > My mappings are correct, they are quite simple and I can do all > > > operations perfectly. I basically have an Id, a Parent and a Children > > > properties, I am mapping a parent-child relationship. > > > > > The exception I get is: > > > > > QueryException: could not resolve property: Children.Id of:SomeClass > > > > > Any ideas? Where can I get more support for LINQ to NHibernate? > > > > > Thanks, > > > > > Ricardo Peres > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
