Reputation: 2175
I'm using Fluent to add mappings from an assembly. That takes nearly 5 seconds. Then, getting a session factory takes another 1.5. Is there anyway to get a compiled output from this guy once, and serialize it to disk:
Fluently.Configure(config)
.Mappings(cfg =>
{
cfg.FluentMappings.AddFromAssemblyOf<Entity>()
.Conventions.Add(ForeignKey.EndsWith("Id"));
})
.BuildConfiguration();
We have about 15 models. Is there a faster way to do this? I don't mind having to manually managed some cached output. A 6+ second penalty for each test class is pretty brutal.
Upvotes: 2
Views: 593
Reputation: 57939
Serializing the configuration for reuse is viable:
http://nhibernate.info/blog/2009/03/13/an-improvement-on-sessionfactory-initialization.html
Upvotes: 2