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,所以爲什麼我得到這個錯誤?謝謝 。 有人可以幫我解決這個問題嗎?