Hi guys,
I'm looking at migrating our currently hand-coded ORM to NHibernate. I'm having trouble with mapping a common idiom in our schemas. Here's an example:
Code:
class Session {
public int ID;
public string Workstation;
}
This is represented in the database as follows:
Code:
CREATE TABLE Workstation (
ID int,
Name varchar(max)
)
CREATE TABLE Session (
ID int,
Workstation int
)
With Session.Workstation referring to Workstation.ID.
I realise that the usual way to address this would be to create a Workstation class, and this is of course desirable if the object has any other problems - but we use this pattern a lot just to eliminate string duplication (ie, there will never be additional attributes of the Workstation object).
Is there a way to address this with an NH mapping? I haven't managed to find anything that seems relevant in the documentation.
Cheers,
-G