我需要使用NHibernate将具有Enums列表的类映射到db表
这是对象
public class Driver : IIdentity
{
private IList<Licence> licences;
/// <summary>
/// The drivers licences
/// </summary>
public virtual IList<Licence> Licences
{
get
{
return this.licences;
}
set
{
this.licences = value;
}
}
..... rest of the class ....
}
//the enum
public enum Licence
{
FivePersonCar = 5,
SixPersonCar = 6
}
Run Code Online (Sandbox Code Playgroud)
----------------这里是DB表
TABLE [dbo].[DriverLicence](
[DriverId] [int] NOT NULL,
[Level] [int] NOT NULL)
TABLE [dbo].[Driver](
[DriverId] [int] NOT NULL,
[Name] [varchar](150) NULL)
-------------这是我的驱动程序的Fluent地图
public class DriverMap …Run Code Online (Sandbox Code Playgroud)