private static ISessionFactory BuildNHibernateSessionFacotory() { var typesThatShouldBeMapped = Assembly.GetAssembly(typeof(Entity)).GetExportedTypes().Where(t => t.Namespace.EndsWith("DTOs")); var cfg = new NHibernate.Cfg.Configuration(); cfg.Properties[NHibernate.Cfg.Environment.CollectionTypeFactoryClass] = typeof(Sharetronix.Cfg.ForNHibernate.Net4CollectionTypeFactory).AssemblyQualifiedName; cfg = cfg.AddAutoMappings(typesThatShouldBeMapped, customClassMappings); if (isNewInstance) cfg.CreateDatabaseTables(); return cfg.BuildSessionFactory(); }
private static ISessionFactory BuildNHibernateSessionFacotory() { var typesThatShouldBeMapped = new List<Type>(); typesThatShouldBeMapped.Add(typeof(CommittedEvents)); typesThatShouldBeMapped.Add(typeof(LaCore.Hyperion.Ports.DTOs.Log)); BinaryWithProtobufUserType.Serializer = protoregSerializer; var cfg = new NHibernate.Cfg.Configuration().AddAutoMappings(typesThatShouldBeMapped, customClassMappings); if (isNewInstance) cfg.CreateDatabaseTables(); return cfg.BuildSessionFactory(); }