开发者

Fluent NHIbernate Freezes much

开发者 https://www.devze.com 2023-01-23 03:17 出处:网络
According to profiler it takes 24 sec for FluentConfiguration.BuildConfiguration to complete. Here\'s the code I use to get Configuration:

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<ProxyFa开发者_如何转开发ctoryFactory>()
         .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.

0

精彩评论

暂无评论...
验证码 换一张
取 消