コード例 #1
0
ファイル: Bootstrapper.cs プロジェクト: Elders/Experiments
        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();
        }
コード例 #2
0
        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();
        }