I have an entity (a table) that I want to map it in NHibernate using fluent
. There is an answer already for this on stack overflow but does not work for me (I couldn't add any comment to that question due to low reputation). Would someone please complete question marks in following code for me.
class MyEntity: ??? // Entity class has already an Id property
{
public int Id1 {get; set;}
public int Id2 {get; set;}
}
class MyEntityMap: ClassMap<MyEntity>
{
public MyEntityMap() // should mapping be in constructor?
{
...
CompositeId().??? // Gives me warning, call to virtual!
...
}
}
Using CompositeId() method gives me warning that I have called a virtual method within the constructor. How should I get rid of the warning?