Карта к списку Enums?
Мне нужно сопоставить класс, который имеет список перечислений в таблицу БД, используя NHibernate
вот объекты
public class Driver : IIdentity
{
private IList licences;
///
/// The drivers licences
///
public virtual IList Licences
{
get
{
return this.licences;
}
set
{
this.licences = value;
}
}
..... rest of the class ....
}
//the enum
public enum Licence
{
FivePersonCar = 5,
SixPersonCar = 6
}
---------------- вот таблица БД
TABLE [dbo].[DriverLicence]( [DriverId] [int] NOT NULL, [Level] [int] NOT NULL)
TABLE [dbo].[Driver]( [DriverId] [int] NOT NULL, [Name] [varchar](150) NULL)
------------- Вот моя беглая карта для водителя
public class DriverMap : ClassMap
{
public DriverMap()
{
Id(x => x.Id).WithUnsavedValue(0).GeneratedBy.Identity();
Map(x => x.Name);
HasManyToMany(x => x.Licences)
.WithTableName("DriverLicence")
.AsElement("Level").AsBag();
HasManyToMany(x => x.InsuredToDrive)
.CollectionType()
.WithTableName("InsuredWith");
}
}
----- Это генерирует следующий файл HBM
вот моя ошибка
Ассоциация из таблицы DriverLicence относится к несопоставленному классу: Taxi.DomainObjects.Licence "
Кто-нибудь знает, что я делаю не так?