In my application, I use NHibernate ORM and Automapper to mapping entities to class model. As: fluent-nhibernate/wiki/Auto-mapping
For tables its working.
Problem is when a try mapping db view without Id field, like:
public class VTest
{
[NotNull]
public virtual AAATab AAA { get; set; }
[NotNull]
public virtual BBBTab BBB { get; set; }
}
I create composite key :
public void Override(AutoMapping<VTest> mapping)
{
mapping.IgnoreProperty(x => x.Id);
mapping.CompositeId()
.KeyProperty(x => x.AAA.Id)
.KeyProperty(x => x.BBB.Id);
}
but it not working. A get error, becouse in the db query have select id :
[GenericADOException: could not execute query [ SELECT this_.Id as Id7_0_, this_.AAAId as AAAId7_0_, this_.BBBId as BBB_7_0_ FROM [VTest] this_ ]
Its possible use automapper for this case?