tags:

views:

15

answers:

0

I've got an issue trying to code up some QueryOver query. I've got an entity Branch, which has a list of Users entities - UserList. I've coded the QueryOver object, I've got the join right using an alias, BUT ( see code )

Iesi.Collections.Generic.ISet<User> userAlias = null;
IQueryOver<Branch, Iesi.Collections.Generic.ISet<User>> userQuery = branchQuery.JoinQueryOver( branch => branch.UserList , () =:> userAlias ) ;
ProjectionList projections = Projections.ProjectionList().Add(Projections.Sum<Iesi.Collections.Generic.ISet<User>>( user => user.CreditLimit));

what I now have a problem with is the last line, being the projection. The alias is typed as an ISet, which means it has no properties, IE the code I have there will not compile because and object of Type User has a CreditLimit property but an object of Type ISet, has properties like count and Add/Remove methods. If I change the alias to a type of User and not ISet, well that's just not going to work because I'm working with a set not an entity.

Does anyone have any ideas on how can I code this. This is a very simplified query so starting off with the User entity and joining to Company would work in the above code, but not in my real life scenario where I've got two joining entities.