mLar mLar - 1 year ago 118
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

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download