FluentNHibernate 版本 1.3.0.727
我有以下自定义 TableNameConvention:
public class TableNameConvention : IClassConvention, IClassConventionAcceptance
{
public void Accept(IAcceptanceCriteria<IClassInspector> criteria)
{
criteria.Expect(x => x.TableName, Is.Not.Set);
}
public void Apply(IClassInstance instance)
{
instance.Table(instance.EntityType.Name + "s");
}
}
我有以下实体映射:
public class UserMap : ClassMap<User>
{
public UserMap()
{
Id(x => x.Id).GeneratedBy.Identity();
Map(x => x.Email).Not.Nullable().Length(200);
Map(x => x.FirstName).Length(100);
Map(x => x.LastName).Length(100);
Map(x => x.Password).Not.Nullable().Length(30);
}
}
我正在生成这样的数据库:
var configuration = Fluently.Configure()
.Mappings(m => m.FluentMappings
.AddFromAssemblyOf<IEntity>()
.Conventions.Add<TableNameConvention>())
.BuildConfiguration();
var schema = new SchemaExport(configuration);
schema.Drop(false, true);
schema.Create(false, true);
然后生成数据库用户实体表仍然生成为用户,但不是我想要的用户。它接缝接受方法失败。这是 FluentNHibernate 错误吗?