这是一个权限的设计,有5个表,只是简单写出了逻辑结构,并未做类之间的关联。实际上打算是要做关联的,怎么关联,然后怎么映射呢?
//用户
public class User
{
public virtual int ID { get; protected set; }
public virtual string UserName { get; set; }
}
//用户权限
public class UserRight
{
public virtual int ID { get; protected set; }
public virtual int UserID { get; set; }
public virtual int GroupID { get; set; }
}
//组
public class Group
{
public virtual int ID { get; protected set; }
public virtual string Name { get; set; }
}
//组权
public class GroupRight
{
public virtual int ID { get; protected set; }
public virtual int GroupID { get; set; }
public virtual int UnitRightID { get; set; }
}
//单元权限
public class UnitRight
{
public virtual int ID { get; protected set; }
public virtual string Name { get; set; }
}
大概是这么个关联关系,对吧?怎么映射呢?
User(1) -< UserRight(n) >- Group(1) -<GroupRight(n) >- UnitRight(1)
- -#
可以考虑使用ConfOrm