Without benchmarking it'd be hard to say. My first reaction is no I don't think that time can be reduced. I believe most of the time will be spent in Assembly.GetTypes(), and there's not much we can do about that. If that * isn't* the case, then of course we'll optimise anything that needs to be done. I have to ask, why the concern? Surely 4 seconds on app startup isn't significant if it's only once?
On Wed, Oct 21, 2009 at 2:41 PM, Tobes <[email protected]>wrote: > > Hi folks > > I'm using the auto-mappings and noticed that they're taking quite a > long time to run. I've only got about 6 entities, and the automapping > code and the entities are in the same assembly. > > Here's the timing data... > > NH configured from file after 925 ms > AutoMappings created after 5020 ms <--(roughly 4 seconds!) > SessionFactory created after 7791 ms <--(roughly 2 seconds) > > Here's the code... > > ========= > cfg.Configure(configFileLocation); > Console.WriteLine("NH configured after {0} ms" > factory = Fluently.Configure(cfg) > .Mappings(m =>m.AutoMappings.Add > (CustomAutoMappings.CreateAutopersistenceModel())) > .ExposeConfiguration(cc => { Console.WriteLine > ("AutoMappings created after {0} ms", sw.ElapsedMilliseconds); }) > .BuildSessionFactory(); > Console.WriteLine("SessionFactory created after {0} ms", > sw.ElapsedMilliseconds); > ========= > > And the code for the auto mappings.. > > > ========= > public static AutoPersistenceModel CreateAutopersistenceModel() > { > var model = new AutoPersistenceModel(); > model > //Load in types from the assembly containing > entities > > .AddEntityAssembly(typeof(CustomAutoMappings).Assembly) > > //Schedules don't need their own table > .Setup(s=>s.IsComponentType = type => type > == typeof(Schedule)) > > //We don't map Entity as a separate table > .IgnoreBase<EntityWithTypedId<Guid>>() > > //Only interestd in mapping classes that > derive from Entity > .Where(t => t.BaseType == > typeof(EntityWithTypedId<Guid>)) > > .Override<Booking>(map => map.References(x > => > x.Contact).Cascade.All()) > ; > return model; > > } > ====== > > And ideas on how I can reduce that 4 seconds for AutoMapping down? > > Thanks > > T > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Fluent NHibernate" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/fluent-nhibernate?hl=en -~----------~----~----~----~------~----~------~--~---
