Can you send the mappings for GroupMember, Group and User? -Markus
2009/8/24 William Chang <[email protected]> > > SOURCE CODE FORMATING CORRECTION (don't use gmail) > > From my understanding, I thought doing this FIRST make sense, because > ICriterion can take multiple criteria on properties. But, I get a > server error, "could not resolve property: memberUser.userIsDeleted > of: Testsoft.Data.Models.GroupMember": > /// <summary>Get group members.</summary> > public static IList<Models.GroupMember> GetGroupMembers(Guid > groupId) { > return Models.GroupMember.FindAll( > Restrictions.And( > Restrictions.Eq("memberGroup.groupId", groupId), > Restrictions.Eq("memberUser.userIsDeleted", false) > ) > ); > } > > > This works, it is a deep query into another class called "Group" > containing a property called "groupId". > /// <summary>Get group members.</summary> > /// <summary>Get group members.</summary> > public static IList<Models.GroupMember> GetGroupMembers(Guid > groupId) { > return Models.GroupMember.FindAll( > Restrictions.Eq("memberGroup.groupId", groupId) > ); > } > > > This doesn't work, same idea as above Group.groupId, but doing only > User.userIsDeleted. I got a server error, "could not resolve property: > memberUser.userIsDeleted of: Testsoft.Data.Models.GroupMember": > /// <summary>Get group members.</summary> > public static IList<Models.GroupMember> GetGroupMembers(Guid > groupId) { > return Models.GroupMember.FindAll( > Restrictions.Eq("memberUser.userIsDeleted", false) > ); > } > > > My workaround, I end up using "DetachedCriteria" to do a deep query > with multiple criteria of properties from different classes (aka > entities): > /// <summary>Get group members.</summary> > public static IList<Models.GroupMember> GetGroupMembers(Guid > groupId) { > return Models.GroupMember.FindAll > (DetachedCriteria.For<Models.GroupMember>().Add( > Restrictions.Eq("memberGroup.groupId", groupId) > ).CreateCriteria("memberUser").Add( > Restrictions.Eq("userIsDeleted", false) > )); > } > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Castle Project Users" 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/castle-project-users?hl=en -~----------~----~----~----~------~----~------~--~---
