我有一个旧设计的数据库模式,我想用 Fluent-Nhibenrate 映射它。
架构看起来像这样:
Table:Users
ID Number PK
Table:Kiosk
User_ID Number PK, FK -> Users.ID
Xml Varchar
Table:Email
User_ID Number PK, FK -> Users.ID
Update_Date Date
我想用看起来像这样的映射对象来实现:
public class User
{
private virtual Email _email {get;set;}
public virtual int Id {get;set;}
public virtual string Email
{
get
{
return _email.Email;
}
set
{
_email.Email = value;
_email.UpdateDate = DateTime.Now();
}
}
public virtual Kiosk Kiosk {get;set;}
public virtual bool HasKiosk
{
get
{
return (Kiosk != null);
}
}
}
public class Kiosk
{
public virtual string XmlKiosk {get;set;}
}
public class Email
{
public virtual string Email {get;set;}
public virtual DateTime UpdateDate {get;set;}
}
有任何想法吗?
谢谢你,阿米尔。