1
我有以下问题,当我试图在我的类映射流利地图ID
Stack trace:
Inner exception message: could not resolve property: Project_ID of: Messenia.Data.Models.Project
这里是我的配置
private StaticHibernate() {
new NHibernate.ByteCode.Castle.ProxyFactoryFactory();
SessionFactory = Fluently.Configure()
.Database (MySQLConfiguration.Standard
.ConnectionString ("database=messenia;server=localhost;uid=root;pwd=root"))
.ExposeConfiguration (c => c.Properties.Add ("hbm2ddl.keywords", "none"))
.Mappings(m => m.AutoMappings.Add(AutoMap.AssemblyOf<Entity>(new EntityAutoMappingConfiguration())
.IgnoreBase<Entity>()
.UseOverridesFromAssemblyOf<Entity>()
.Conventions.Add(typeof(PrimaryKeyNamePlusId)))) .BuildSessionFactory();
和:
public class EntityAutoMappingConfiguration : DefaultAutomappingConfiguration
{
public override bool ShouldMap(Type type)
{
return type.GetInterfaces().Contains(typeof(IPersistable));
}
}
和:
public class PrimaryKeyNamePlusId : IIdConvention
{
public void Apply(IIdentityInstance instance)
{
instance.Column(instance.EntityType.Name + "_ID");
}
}
类项目不包含属性Project_Id,但它包含支持ID,所以为什么我得到这个错误?谢谢 。 有人可以帮我解决这个问题吗?