I am trying to split the configuration in Fluent NHibernate between two classlibraries (dll's). The first classlibrary would configure certain listeners in NHibernate (for auditing and security) and the second would map/automap the entities. Any good ideas for how to pass the Fluent config between the libraries? One idea I have is using Castle Windsor (part of my infrastructure already) and installers to pass the config via the container between the libraries. Does that sound reasonable?
0
votes
1 Answers
0
votes
i have a similar scenario where configure the mappings somewhere else. I dont pass the config around, i just take the mappings as a whole from different providers.
For example:
Fluently.Configure()
.Mappings(m => m.AutoMappings.Add(Container.Resolve<IAutoMapProvider>().Get())
public class AutoMapProvider : IAutomapProvider
{
...
public static AutoPersistenceModel Get()
{
return AutoMap
.AssemblyOf<MyObjectBase>(new MyConfiguration())
.IgnoreBase<MyObjectBase>()
.Conventions.Setup(c =>
// ...
}
}