mLar mLar - 3 months ago 31
C# Question

Fluent nhibernate Automaping by property name

Is there a way to map properties of an entity automatically to column names (without code)

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

What I would like is to map this class to table PERSON(ID,NAME) without doing it explicitly in code or xml


When your properites have the same name like the columns in the table you can use

Fluently.Configure().Mappings(m => m.FluentMappings.AddFromAssembly(

it will automap all classes in the given assembly.