【问题标题】:Fluent nhibernate Automaping by property nameFluent nhibernate Automaping by property name
【发布时间】:2017-02-03 21:34:39
【问题描述】:

有没有办法将实体的属性自动映射到列名(无需代码)

Class Person
{
  public int ID{get;set;}
  public string NAME {get;set;}
}

我想要的是将此类映射到表 PERSON(ID,NAME) 而不在代码或 xml 中显式地进行

【问题讨论】:

    标签: c# orm fluent-nhibernate mapping


    【解决方案1】:

    当你的属性与表中的列同名时,你可以使用

    Fluently.Configure().Mappings(m => m.FluentMappings.AddFromAssembly(
                        Assembly.GetAssembly(typeof(MyEntityType))
                        ));
    

    它将自动映射给定程序集中的所有类。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-03-17
      • 1970-01-01
      • 2011-04-10
      • 1970-01-01
      • 1970-01-01
      • 2011-02-27
      • 1970-01-01
      相关资源
      最近更新 更多