You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
XmlSchemaValidationException: The element 'union-subclass' in namespace
'urn:nhibernate-mapping-2.2' has invalid child element 'joined-subclass'
in namespace 'urn:nhibernate-mapping-2.2'.
My setup is as follows:
public abstract class AbstractBaseEntity
{
public virtual string Id { get; set; } = Guid.NewGuid().ToString();
public virtual AbstractIntermediateEntity Intermediate { get; set; }
public virtual ConcreteEntity Concrete { get; set; }
}
public abstract class AbstractIntermediateEntity : AbstractBaseEntity
{
public virtual string Property { get; set; }
}
public class ConcreteEntity : AbstractIntermediateEntity
{
public virtual string OtherProperty { get; set; }
}
public class Configuration : DefaultAutomappingConfiguration
{
public override bool ShouldMap(Type type) => base.ShouldMap(type) && typeof(AbstractBaseEntity).IsAssignableFrom(type);
}
...
var sessionFactory = Fluently.Configure()
.Database(SQLiteConfiguration.Standard.UsingFile(dataStorage.DataStorage.PathToDbFile))
.Mappings(m => m.AutoMappings
.Add(AutoMap.AssemblyOf<AbstractBaseEntity>(new Configuration())
.Override<AbstractBaseEntity>(_ => _.UseUnionSubclassForInheritanceMapping())
.IncludeBase<AbstractBaseEntity>()
.IncludeBase<AbstractIntermediateEntity>()))
.BuildSessionFactory();
The hmb I am getting looks like this, which is wrong:
I am getting the following error from nhibernate:
My setup is as follows:
The hmb I am getting looks like this, which is wrong:
Note that I can get this to work with fluent mappings, using ClassMap, SubclassMap and SubclassMap but I really ought to be using Automap!
The text was updated successfully, but these errors were encountered: