Quantcast
Channel: Telerik Forums RSS
Viewing all articles
Browse latest Browse all 94857

Mapping properties from base class

$
0
0

Hi,

I have these 2 classes:

 

publicclassBase
{
  protectedString mValue;
  publicString Value
  {
    get{ returnmValue;}
    set{ mValue = value; }
  }
}
 
publicclassDerived : Base
{
  publicintId { get; set; }
}

and I want to map only the Derived class to a table, something like this:

 

var derived = newMappingConfiguration<Derived>();
derived.MapType(d => new
{
  Id = d.Id,
});
derived.HasProperty(d => d.Id).IsIdentity(KeyGenerator.Autoinc);
derived.HasProperty(d => d.Value).HasFieldName("Base.mValue");

 

For Base class there is no mapping to a table and neither inheritance. Unfortunately this does not work and I get the error:

Additional information: Mapping for field 'Base.mValue' is specified in the file 'config', but the field is not present in the class 'Derived'.

 


Viewing all articles
Browse latest Browse all 94857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>