fluent-nhibernate icon indicating copy to clipboard operation
fluent-nhibernate copied to clipboard

confused exception message when SubclassMap duplicated map a property of baseclass.

Open phiree opened this issue 7 years ago • 2 comments

Entities:

class Base
{
    public string Id{get;set;} 
    public string Name{get;set;}
}
class MyClass:Base
{
    public int Age{get;set;}
}

Mapping:

class BaseMap:ClassMap<Base>
{
     Id(x=>x.Id);
    Map(x=>x.Name);
}
class MyClassMap:SubClassMap<MyClass>
{
    Map(x=>x.Name);   <---------------------Wrong in runtime.
}

this incorrect map throw System.ArgumentOutOfRangeException . it is confused. it maybe " don't mapping same property of base class"...

phiree avatar Oct 10 '17 09:10 phiree

How do you solve this problem?,could you telll me

LIZIQIANG123 avatar Aug 17 '19 00:08 LIZIQIANG123

just don't map "Name" again .

phiree avatar Aug 19 '19 03:08 phiree