private Tuple <XElement, IExtendedPropertyMapper, string> generateInheritanceMappingData( PersistentClass pc, EntityXmlMappingData xmlMappingData, AuditTableData auditTableData, string inheritanceMappingType) { var extendsEntityName = VerEntCfg.GetAuditEntityName(pc.Superclass.EntityName); var hasDiscriminator = pc.Discriminator != null; var classMapping = MetadataTools.CreateSubclassEntity(xmlMappingData.MainXmlMapping, inheritanceMappingType, auditTableData, extendsEntityName, hasDiscriminator ? pc.DiscriminatorValue : null, pc.IsAbstract.HasValue && pc.IsAbstract.Value); // The id and revision type is already mapped in the parent // Getting the property mapper of the parent - when mapping properties, they need to be included var parentEntityName = pc.Superclass.EntityName; EntityConfiguration parentConfiguration; if (!EntitiesConfigurations.TryGetValue(parentEntityName, out parentConfiguration)) { throw new MappingException("Entity '" + pc.EntityName + "' is audited, but its superclass: '" + parentEntityName + "' is not."); } var parentPropertyMapper = parentConfiguration.PropertyMapper; var propertyMapper = new SubclassPropertyMapper(new MultiPropertyMapper(), parentPropertyMapper); return(new Tuple <XElement, IExtendedPropertyMapper, string>(classMapping, propertyMapper, parentEntityName)); }
private Triple<XmlElement, IExtendedPropertyMapper, String> GenerateInheritanceMappingData( PersistentClass pc, EntityXmlMappingData xmlMappingData, AuditTableData auditTableData, String inheritanceMappingType) { String extendsEntityName = VerEntCfg.GetAuditEntityName(pc.Superclass.EntityName); XmlElement class_mapping = MetadataTools.CreateSubclassEntity(xmlMappingData.MainXmlMapping, inheritanceMappingType, auditTableData, extendsEntityName, pc.DiscriminatorValue); // The id and revision type is already mapped in the parent // Getting the property mapper of the parent - when mapping properties, they need to be included String parentEntityName = pc.Superclass.EntityName; EntityConfiguration parentConfiguration = EntitiesConfigurations[parentEntityName]; if (parentConfiguration == null) { throw new MappingException("Entity '" + pc.EntityName + "' is audited, but its superclass: '" + parentEntityName + "' is not."); } IExtendedPropertyMapper parentPropertyMapper = parentConfiguration.PropertyMapper; IExtendedPropertyMapper propertyMapper = new SubclassPropertyMapper(new MultiPropertyMapper(), parentPropertyMapper); return Triple<XmlElement, IExtendedPropertyMapper, String>.Make<XmlElement, IExtendedPropertyMapper, String>(class_mapping, propertyMapper, parentEntityName); }