當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。