当前位置: 首页>>代码示例>>C#>>正文


C# Configuration.BuildSessionFactory方法代码示例

本文整理汇总了C#中Configuration.BuildSessionFactory方法的典型用法代码示例。如果您正苦于以下问题:C# Configuration.BuildSessionFactory方法的具体用法?C# Configuration.BuildSessionFactory怎么用?C# Configuration.BuildSessionFactory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Configuration的用法示例。


在下文中一共展示了Configuration.BuildSessionFactory方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetUp

        public void SetUp()
        {
            var builder = new NHibernateSagaStorage();
            var properties = SQLiteConfiguration.InMemory();

            var configuration = new Configuration().AddProperties(properties);
            var settings = new SettingsHolder();
            settings.Set("TypesToScan", new[] { typeof(SagaWithAbstractBaseClass), typeof(ContainSagaData), typeof(MyOwnAbstractBase) });
            builder.ApplyMappings(settings, configuration);
            sessionFactory = configuration.BuildSessionFactory() as SessionFactoryImpl;
        }
开发者ID:james-wu,项目名称:NServiceBus.NHibernate,代码行数:11,代码来源:When_automapping_sagas_with_abstract_base_class.cs

示例2: Build

        public static SessionFactoryImpl Build()
        {
            var types = Types();

            var builder = new NHibernateSagaStorage();
            var properties = SQLiteConfiguration.InMemory();

            var configuration = new Configuration().AddProperties(properties);
            var settings = new SettingsHolder();
            settings.Set("TypesToScan", types);
            builder.ApplyMappings(settings, configuration);
            return configuration.BuildSessionFactory() as SessionFactoryImpl;
        }
开发者ID:james-wu,项目名称:NServiceBus.NHibernate,代码行数:13,代码来源:SessionFactoryHelper.cs

示例3: SetUp

        public void SetUp()
        {
            cfg=Fluently.Configure()
                .Mappings(mappings => mappings.FluentMappings.AddFromAssemblyOf<UserMap>())
                .Database(MsSqlConfiguration.MsSql2008
                            .AdoNetBatchSize(20)
                            .ConnectionString(stringBuilder=>
                                              		stringBuilder.Database("test")
                                              			.TrustedConnection()
                                              			.Server("."))
                            .ShowSql()
                            .Raw("hbm2ddl.keywords", "auto-quote")
                ).BuildConfiguration();

            factory = cfg.BuildSessionFactory();
            var export = new SchemaExport(cfg);
            export.Execute(true, true, false);
        }
开发者ID:BlogSharp,项目名称:Blogsharp,代码行数:18,代码来源:MappingsFixture.cs

示例4: SetupContext

        public void SetupContext()
        {
            var cfg = new Configuration()
                .DataBaseIntegration(x =>
                {
                    x.Dialect<SQLiteDialect>();
                    x.ConnectionString = string.Format(@"Data Source={0};Version=3;New=True;", Path.GetTempFileName());
                });

            var mapper = new ModelMapper();
            mapper.AddMapping<Config.SubscriptionMap>();

            cfg.AddMapping(mapper.CompileMappingForAllExplicitlyAddedEntities());

            new SchemaExport(cfg).Create(false, true);

            subscriptionStorageSessionProvider = new SubscriptionStorageSessionProvider(cfg.BuildSessionFactory());

            storage = new SubscriptionPersister(subscriptionStorageSessionProvider);
        }
开发者ID:james-wu,项目名称:NServiceBus.NHibernate,代码行数:20,代码来源:InMemoryDBFixture.cs

示例5: UseNHibernateGatewayPersisterInternal

        private static Configure UseNHibernateGatewayPersisterInternal(this Configure config, Configuration configuration)
        {
            ConfigureNHibernate.ThrowIfRequiredPropertiesAreMissing(configuration.Properties);

            GatewayPersister.NHibernate.Installer.Installer.RunInstaller = true;

            ConfigureNHibernate.AddMappings<GatewayMessageMap>(configuration);

            config.Configurer.ConfigureComponent<GatewayPersister.NHibernate.GatewayPersister>(
                DependencyLifecycle.SingleInstance)
                .ConfigureProperty(p => p.SessionFactory, configuration.BuildSessionFactory());

            return config.RunGateway();
        }
开发者ID:johannesg,项目名称:NServiceBus.NHibernate,代码行数:14,代码来源:ConfigureNHibernateGatewayPersister.cs

示例6: GenerateProxies

        protected virtual GenerateProxiesResult GenerateProxies(Configuration nhibernateConfiguration, string modulePath)
        {
            ModuleScope moduleScope = new ModuleScope(true, ModuleScope.DEFAULT_ASSEMBLY_NAME, modulePath, ModuleScope.DEFAULT_ASSEMBLY_NAME, modulePath );
            IDictionary proxies = new Hashtable();

            try
            {
                CastleProxyFactoryFactory.ProxyFactory = new CastleProxyFactory(new DefaultProxyBuilder(moduleScope), proxies);
                using (nhibernateConfiguration.BuildSessionFactory())
                {
                }
            }
            finally
            {
                CastleProxyFactoryFactory.ProxyFactory = null;
            }

            moduleScope.SaveAssembly();
            moduleScope = null;

            AssemblyName proxyAssemblyName = new AssemblyName(ModuleScope.DEFAULT_ASSEMBLY_NAME);
            proxyAssemblyName.CodeBase = modulePath;

            Assembly proxyAssembly = Assembly.Load(proxyAssemblyName);

            return new GenerateProxiesResult(proxies, proxyAssembly);
        }
开发者ID:spib,项目名称:nhcontrib,代码行数:27,代码来源:CastleProxyGenerator.cs

示例7: MsSqlDaoFactory

 public MsSqlDaoFactory()
 {
     Configuration config = new Configuration();
     config.Configure();
     this.sessionFactory = config.BuildSessionFactory();
 }
开发者ID:olivierdagenais,项目名称:testoriented,代码行数:6,代码来源:MsSqlDaoFactory.cs


注:本文中的Configuration.BuildSessionFactory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。