We have a legacy Database that we want to read data from using
NHibernate. The tables that we want to map are the following:
Users
=====
PK - UserId
PK - GroupId
LocationSource
etc...
Locations
=======
PK - UserId
PK - GroupId
PK - Source
X
Y
Every user has one or more locations. A location can be entered from
different sources, which are identified by the Source column. the
Users table's LocationSource column holds the most relevant location
source for that user.
In the current application we're writing, we need only the last
location. this is done mainly for performance reasons, we don't want
to load all the locations (using outer join) whenever we load a User
(Lazy Loading is out of the question either).
The classes will look something like that:
public class UserKey
{
public int UserId {get;set;}
public int GroupId {get;set;
}
public class Location
{
public double X {get;set;}
public double Y {get;set;}
public LocationSource Source {get;set;}
}
public class User
{
public UserKey Id {get; set;}
public Location Location {get;set;}
}
I cannot figure out how to map the database scheme to those class.
Everything I tried failed so far.
I will appreciate your help.
--
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.