Fluent NHIbernate Freezes much
According to profiler it takes 24 sec for FluentConfiguration.BuildConfiguration to complete. Here's the code I use to get Configuration:
MsSqlConfiguration persistenceConfigurer = MsSqlConfiguration .MsSql2005 .ConnectionString(connectionStringBuilder => connectionStringBuilder .Server(server) .Database(database) .Username(userName) .Password(password)) .ProxyFactoryFactory<ProxyFactoryFactory>() .CurrentSessionContext<ThreadStaticSessionContext>() .DoNot.ShowSql(); FluentConfiguration cfg = Fluently.Configure() .Database(persistenceConfigurer) .Mappings(m => m.FluentMappings.AddFromAssemblyOf<ExecutorMap>()); return cfg.BuildConfiguration();
The number of map-files is 19. Is it common for Fluent NHibernate to work so long? Might it be my fault? What could be wrong? Thanks in advance.
If you're using a profiler, you should be able to see what calls inside of BuildConfiguration are taking up that time. What are they?
Assembly scanning would be my guess. Is the assembly that contains your mappings especially large? You've told Fluent NHibernate to scan your assembly for mappings, so regardless of how few mappings there are it still has to scan the entire assembly for them.