I've fixed this problem by modifying AutoMapper.MergeMap<T> to check
for the existence of any SubClassPart<,,> for that derived type in the
AutoMap<T>.Parts of the type being mapped. I'll submit a patch for
that in a minute. More urgently though, fixing that uncovered another
problem:
Whereas I'd been getting errors on schema validation about the
existence of the subclass element in the class mapping due to the
joinedsubclass element being created... now the schema validation
succeeds and I get an error further down the chain when i try to do a
schema export:
PersistenceTests.Can_Map_Orders_To_Database :
FailedSystem.InvalidCastException: Unable to cast object of type
'NHibernate.Mapping.Bag' to type 'NHibernate.Mapping.SimpleValue'.
at NHibernate.Cfg.Configuration.SecondPassCompile()
at NHibernate.Cfg.Configuration.GenerateDropSchemaScript(Dialect
dialect)
at NHibernate.Tool.hbm2ddl.SchemaExport..ctor(Configuration cfg,
IDictionary`2 connectionProperties)
at NHibernate.Tool.hbm2ddl.SchemaExport..ctor(Configuration cfg)
at
Core.Infrastructure.Data.NHibernate.Tests.PersistenceTests.<SetUp>b__0
(Configuration cfg) in PersistenceTests.cs: line 25
at FluentNHibernate.Cfg.FluentConfiguration.BuildSessionFactory() in
FluentConfiguration.cs: line 97
FluentNHibernate.Cfg.FluentConfigurationException: An invalid or
incomplete configuration was used while creating a SessionFactory.
Check PotentialReasons collection, and InnerException for more detail.
at FluentNHibernate.Cfg.FluentConfiguration.BuildSessionFactory() in
FluentConfiguration.cs: line 103
at Core.Infrastructure.Data.NHibernate.Tests.PersistenceTests.SetUp()
in PersistenceTests.cs: line 22
This seems to be coming from within the core NHibernate dll and since
I have no familiarity with Nhibernate prior to FNH I'm totally stumped
and have no idea how to proceed. I'm exporting the schema to an in-
memory SQLite database btw. Should I be posting this on the nhusers
forum?