Hi, We're using the conformist ByCode mapping in an application which has a 'core' mappings assembly and then arbitrary plugin mapping assemblies. These plugins provide additional features such as further subclasses, and there are dependencies between them - for example, the core assembly might declare a mapping for type 'Foo', plugin 1 a subclass mapping for type 'Bar' inheriting from Foo, and plugin 2 a third subclass mapping for type 'Baz' inheriting from Bar. The NHibernate configuration is generated by simply iterating over the assemblies in the 'mappings' directory, extracting the exported types, and adding them to the model mapper before calling mapper.CompileMappingForAllExplicitlyAddedEntities() to create the final result and feeding that into cfg.AddDeserializedMapping().
This has been working well until a scenario where the class mappings (which are effectively ordered randomly) are added with a dependent before a dependency, such as [Foo, Baz, Bar] in the example above rather than [Foo, Bar, Baz]. As a result of this, the call to AddDeserializedMapping() fails with the error "Cannot extend unmapped class Bar"; if added in dependency order then all works as expected. Is there a way of informing the ByCode mapping system that Baz depends upon Bar so that it can ensure that Baz is mapped after Bar in the compilation phase regardless of the order in which the mapping types were added? Given that everything is ordered perfectly in the XML export if the types are in the same assembly I'm assuming that there's something I've missed to achieve this. Pseudo-code: AssemblyA.SuperClass AssemblyB.SubClass2: SubClass1 AssemblyC.SubClass1 : SuperClass MappingAssemblyA.SuperClassMapping: ClassMapping<SuperClass> MappingAssemblyB.SubClass1Mapping: SubclassMapping<SubClass1> <--- fails if added before SubClass2Mapping MappingAssemblyC.SubClass2Mapping: SubclassMapping<SubClass2> Thanks, Pete -- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
