I'd like to divide domain model classes and query-only classes in my
application. I'd use model classes for write operations and query
classes for reading data. Now I'm struggling with mapping of a query
class which should have flattened some of the properties. My classes
look something like:
class User
{
public long Id;
public string Name;
public Role Role;
}
class UserQueryItem
{
public long Id;
public string Name;
public long RoleId;
public string RoleName;
}
Now I'm trying to map both classes against same DB tables and make
queries like "from UserQueryItem where RoleName = 'admin'" possible.
It's quite easy to map the UserQueryItem class using some hidden Role
property which would fill RoleId + RoleName fields in its setter, but
I'm not able to figure out how to enable queries against flattened
RoleId and RoleName fields. Is it possible to achieve this somehow? I
know I could query using Role.Id or Role.Name with alias, but this is
not a solution for me at the moment.
--
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.