NHibernate DuplicateMappingException when mapping abstract class and subclass -
I have an abstract class and subclass, and I want it to map your database using NHibernate. I am using flutes, and how to mapping, but when I add a NHibernate to mapping subclass. Duplicate mapping expansion is thrown when mapping is done. Why?
Here are my (simplified) classes:
Public intangible square field value {Public Ent ID (Receive; Set;}; }} public class StringFieldValue: FieldValue {public string ValueAsString {get; set;} public override object value {get {Return ValueAsString;} set {ValueAsString = (string) value;}}}
More mapping:
Public square fieldWallmapping: Classmaker & lt; FieldValue & gt; {public That Fildvoluming () {id (M = & gt; Maiaidi). Were generated by (Acaielo) ( "1"); // DiscriminateSubClassesOnColumn ( "type");}} public class Stringvolumaping: subclass map & lt; Stringfild value & gt; {public string value mapping () {map (M = & gt; M. Velustresing). Lambik (100);}}
exception:
NHibernate.MappingException: Could not compile mapping documents: (XmlDocument) ----> NHibernate.DuplicateMappingException: Duplicate class / entity Mapping NamespacePath.Strinfilled Value
Any ideas?
Problems searched. It turned out that I had the same assembly references several times database used to configure durability model:
public class Mapingspirshisaidmodel: Prsistens model {public Mapingssfrsisens Moodel () {AddMappingsFromAssembly (FooMapping) assembly.); AddMappingsFromAssembly (typeof (BarMapping) .Assembly); // where Foaming and Baremping are in the same assembly. }}
Apparently this is not a problem for classmap-mapping. But for subclassaps this does not handle it well, due to which there are duplicate mapping- and therefore duplicate mapping expansion. Removing duplicates in the stability model fixes the problem
Comments
Post a Comment