A while ago I was having issues using configuring fluent NHibernate with an external configuration file. I kept running into the issue of mappings not being registered. I was finally able to get it working appropriately and thought I would share my solution. The key is to configure the normal mappings first and then pass that configuration in when configuring fluent NHibernate.
string configFile = "hibernate.cfg.xml"; //setup the normal map configurationConfiguration normalConfig = new Configuration().Configure(configFile); //setup the fluent map configurationFluently.Configure(normalConfig) .Mappings( m => m.FluentMappings .ConventionDiscovery.Add(DefaultLazy.AlwaysFalse()) .AddFromAssemblyOf<UserMap>()) .BuildConfiguration();
