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


C# Configuration.BuildMappings方法代码示例

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


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

示例1: Configure

 public static void Configure(string pathToConfig, Assembly mappingsAssembly)
 {
     _cfg = new Configuration();
     _cfg.Configure(pathToConfig);
     _cfg.AddAssembly(mappingsAssembly);
     _cfg.BuildMappings();
     _sessionFactory = _cfg.BuildSessionFactory();
 }
开发者ID:perikete,项目名称:QuickPharma,代码行数:8,代码来源:NHibernateHelper.cs

示例2: NwaitingForSuper

		public void NwaitingForSuper()
		{
			Configuration cfg = new Configuration();

			cfg.AddResource(BaseForMappings + "Extendshbm.Customer.hbm.xml", typeof (ExtendsFixture).Assembly);
			Assert.That(cfg.GetClassMapping(typeof (Customer).FullName), Is.Null, "cannot be in the configuration yet!");

			cfg.AddResource(BaseForMappings + "Extendshbm.Employee.hbm.xml", typeof (ExtendsFixture).Assembly);
			Assert.That(cfg.GetClassMapping(typeof (Employee).FullName), Is.Null, "cannot be in the configuration yet!");

			cfg.AddResource(BaseForMappings + "Extendshbm.Person.hbm.xml", typeof (ExtendsFixture).Assembly);

			cfg.BuildMappings();
			Assert.That(cfg.GetClassMapping(typeof (Customer).FullName), Is.Not.Null);
			Assert.That(cfg.GetClassMapping(typeof (Person).FullName), Is.Not.Null);
			Assert.That(cfg.GetClassMapping(typeof (Employee).FullName), Is.Not.Null);
		}
开发者ID:marchlud,项目名称:nhibernate-core,代码行数:17,代码来源:ExtendsFixture.cs

示例3: SetUp

		public void SetUp()
		{
			cfg = new Configuration()
					.AddResource("NHibernate.Test.MappingTest.Wicked.hbm.xml", GetType().Assembly);
			cfg.BuildMappings();
		}
开发者ID:kkozmic,项目名称:nhibernate,代码行数:6,代码来源:NonReflectiveBinderFixture.cs

示例4: JoinedSubclassAndEntityNamesOnly

		public void JoinedSubclassAndEntityNamesOnly()
		{
			Configuration cfg = new Configuration();

			cfg.AddResource(BaseForMappings + "Extendshbm.entitynames.hbm.xml", typeof (ExtendsFixture).Assembly);

			cfg.BuildMappings();
			Assert.That(cfg.GetClassMapping("EntityHasName"), Is.Not.Null);
			Assert.That(cfg.GetClassMapping("EntityCompany"), Is.Not.Null);
		}
开发者ID:marchlud,项目名称:nhibernate-core,代码行数:10,代码来源:ExtendsFixture.cs

示例5: UnionSubclass

		public void UnionSubclass()
		{
			Configuration cfg = new Configuration();

			cfg.AddResource(BaseForMappings + "Extendshbm.unionsubclass.hbm.xml", typeof (ExtendsFixture).Assembly);

			cfg.BuildMappings();

			Assert.That(cfg.GetClassMapping(typeof (Person).FullName), Is.Not.Null);
			Assert.That(cfg.GetClassMapping(typeof (Customer).FullName), Is.Not.Null);
		}
开发者ID:marchlud,项目名称:nhibernate-core,代码行数:11,代码来源:ExtendsFixture.cs

示例6: EntityNamesWithPackageFailureExpectedDiffFiles

		public void EntityNamesWithPackageFailureExpectedDiffFiles()
		{
			Configuration cfg = new Configuration();
			cfg.AddResource(BaseForMappings + "Extendshbm.packageentitynamesf1.hbm.xml", typeof(ExtendsFixture).Assembly);
			cfg.AddResource(BaseForMappings + "Extendshbm.packageentitynamesf2.hbm.xml", typeof(ExtendsFixture).Assembly);

			cfg.BuildMappings();

			Assert.That(cfg.GetClassMapping("EntityHasName"), Is.Not.Null);
			Assert.That(cfg.GetClassMapping("EntityCompany"), Is.Not.Null);
		}
开发者ID:marchlud,项目名称:nhibernate-core,代码行数:11,代码来源:ExtendsFixture.cs

示例7: Configure

 private static void Configure(Configuration config)
 {
     config.BuildMappings();
     new SchemaUpdate(config).Execute(false, true);
 }
开发者ID:hellzbullet,项目名称:RaspberryGPIO,代码行数:5,代码来源:NHibernateConfig.cs

示例8: ConfigureNHibernate

        private void ConfigureNHibernate()
        {
            _configuration = new Configuration();
            _configuration.DataBaseIntegration(x =>
                {
                    if (_inMemory)
                    {
                        x.Dialect<SQLiteDialect>();
                        x.Driver<SQLite20Driver>();
                        x.ConnectionProvider<DriverConnectionProvider>();
                    }
                    else
                        x.Dialect<MsSql2008Dialect>();
                    x.ConnectionString = _connectionString;
                    x.SchemaAction = SchemaAutoAction.Update;
                    x.IsolationLevel = IsolationLevel.ReadCommitted;

                    x.HqlToSqlSubstitutions = "True 1, False 0, true 1, false 0, yes 'Y', no 'N'";
                    x.BatchSize = 200;
                });

            var mappingAssemblies = _assemblies;
            foreach (var mappingAssembly in mappingAssemblies.Where(mappingAssembly => !String.IsNullOrWhiteSpace(mappingAssembly)))
            {
                _configuration.AddAssembly(mappingAssembly);
            }
            _configuration.BuildMappings();
            _configuration.SetProperty(NHEnvironment.CacheDefaultExpiration, 120.ToString());
            _configuration.SetProperty(NHEnvironment.ShowSql, "false");
            _configuration.Proxy(cfg => cfg.ProxyFactoryFactory<DefaultProxyFactoryFactory>());
            _configuration.SessionFactory()
                          .GenerateStatistics();
        }
开发者ID:hoghweed,项目名称:MyOverFlow,代码行数:33,代码来源:NHSupport.cs

示例9: ConfigureNHibernate

        /// <summary>
        /// Configure NHibernate
        /// </summary>
        private void ConfigureNHibernate()
        {
            _configuration = new NHConfiguration();
            _configuration.DataBaseIntegration(x =>
                    {
                        //x.AutoCommentSql = true;
                        //x.Dialect<MsSqlCustomDialect>();
                        x.Dialect<MsSqlCustomDialect>();
                        x.ConnectionString = _connectionString;
                        x.SchemaAction = SchemaAutoAction.Update;
                        x.IsolationLevel = IsolationLevel.ReadCommitted;

                        x.HqlToSqlSubstitutions = "True 1, False 0, true 1, false 0, yes 'Y', no 'N'";
                        x.BatchSize = 15;
                    });

            var mappingAssemblies = _assemblies;
            foreach (var mappingAssembly in mappingAssemblies)
            {
                if (!String.IsNullOrWhiteSpace(mappingAssembly))
                {
                    _configuration.AddAssembly(mappingAssembly);
                }
            }

            _configuration.BuildMappings();
            _configuration.Cache(cfg =>
                                     {
                                         cfg.DefaultExpiration = 120;
                                         cfg.Provider<SysCacheProvider>();
                                         cfg.UseMinimalPuts = true;
                                         cfg.RegionsPrefix = "xyz";
                                         cfg.UseQueryCache = true;
                                     });
            _configuration.SetProperty(NHibernate.Cfg.Environment.CacheDefaultExpiration, 120.ToString());
            _configuration.SetProperty(NHibernate.Cfg.Environment.ShowSql, "false");
            _configuration.Proxy(cfg => cfg.ProxyFactoryFactory<DefaultProxyFactoryFactory>());
            _configuration.SessionFactory()
                          .GenerateStatistics();

            new AuditingEventListener().Register(_configuration);
        }
开发者ID:hoghweed,项目名称:Codebrainr.Site,代码行数:45,代码来源:DataFactory.cs


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