Ok, I have tried this out with my program in some unit tests and it works
fine for me. So a couple of possibilities.
1. You are not using the release version of Linq2NH. You should be using
that along with NH 2.1.0 GA
2. You have incorrectly mapped your collection and possibly you are using
the wrong type of collection.
I have mapped as <bag> but I am sure other collections will work and I am
mapping to a collection property using IList<Children>. I don't think you
are using IList which is why you are calling .Count as a property instead of
.Count() as a method (which is what IList<T> uses).
That is all I can think of, but I have a feeling that .Count() is Linq
whereas .Count is not Linq and so Linq2NH is not translating it into
Criteria properly.
Here is my UnitTest for reference:
[Test]
public void CanQueryForEntriesHavingSplits() {
SetupEntities();
var query = from entry in Session.Linq<Entry>()
where entry.EntrySplits.Count() > 0
select entry;
CollectionAssert.Contains(query, Entries[0]);
CollectionAssert.Contains(query, Entries[3]);
CollectionAssert.DoesNotContain(query, Entries[1]);
CollectionAssert.DoesNotContain(query, Entries[2]);
}
Good luck,
Chris
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---