public Configuration BuildConfiguration() { var mapper = new ConventionModelMapper(); CollectMappingContributorsAndApply(mapper); AR.RaiseOnMapperCreated(mapper, this); var mapping = mapper.CompileMappingForAllExplicitlyAddedEntities(); mapping.autoimport = Source.AutoImport; mapping.defaultlazy = Source.Lazy; if (Source.Debug) { try { File.WriteAllText( Path.Combine( AppDomain.CurrentDomain.BaseDirectory, Name + "mapping.hbm.xml" ), mapping.AsString() ); } catch { /* just bail out */ } } AR.RaiseOnHbmMappingCreated(mapping, this); var cfg = new Configuration(); if (Source.NamingStrategyImplementation != null) { cfg.SetNamingStrategy((INamingStrategy)Activator.CreateInstance(Source.NamingStrategyImplementation)); } foreach (var key in Properties.AllKeys) { cfg.Properties[key] = Properties[key]; } CollectAllContributorsAndRegister(cfg); cfg.AddMapping(mapping); AR.RaiseOnConfigurationCreated(cfg, this); return(cfg); }