當前位置: 首頁>>代碼示例>>C#>>正文


C# Configuration.AddFilterDefinition方法代碼示例

本文整理匯總了C#中NHibernate.Cfg.Configuration.AddFilterDefinition方法的典型用法代碼示例。如果您正苦於以下問題:C# Configuration.AddFilterDefinition方法的具體用法?C# Configuration.AddFilterDefinition怎麽用?C# Configuration.AddFilterDefinition使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在NHibernate.Cfg.Configuration的用法示例。


在下文中一共展示了Configuration.AddFilterDefinition方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: NHibernateConfiguration

        public static void NHibernateConfiguration(TestContext context)
        {
            log4net.Config.XmlConfigurator.Configure();

            Configuration = new Configuration();
            // lendo o arquivo hibernate.cfg.xml
            Configuration.Configure();

            FilterDefinition filterDef = new FilterDefinition(
                "Empresa","EMPRESA = :EMPRESA",
                new Dictionary<string, IType>() {{"EMPRESA", NHibernateUtil.Int32}}, false);
            Configuration.AddFilterDefinition(filterDef);
            filterDef = new FilterDefinition(
                "Ativa", "ATIVO = 'Y'",
                new Dictionary<string, IType>(), false);
            Configuration.AddFilterDefinition(filterDef);

            // Mapeamento por código
            var mapper = new ModelMapper();
            mapper.AddMappings(Assembly.GetExecutingAssembly().GetExportedTypes());
            HbmMapping mapping = mapper.CompileMappingForAllExplicitlyAddedEntities();
            Configuration.AddMapping(mapping);

            // Gerar o XML a partir do mapeamento de codigo.
            //var mappingXMl = mapping.AsString();

            // Mapeamento por arquivo, in resource.
            Configuration.AddAssembly(Assembly.GetExecutingAssembly());

            // Gerando o SessionFactory
            SessionFactory = Configuration.BuildSessionFactory();
        }
開發者ID:hrickmachado,項目名稱:Crowdlearning-Tecnologia-NHibernate,代碼行數:32,代碼來源:Context.cs

示例2: ConfigurationFactory

        public ConfigurationFactory(DatabaseSettings settings)
        {
            _configuration = new Configuration()
                .SetInterceptor(new TenantIdInterceptor(settings.TenantId))
                .DataBaseIntegration(db =>
                {
                    db.ConnectionString = settings.ConnectionString;
                    db.Dialect<MsSql2012Dialect>();
                    db.BatchSize = 100;
                });

            _configuration
                .AddFilterDefinition(new TenantIdDefinition(settings.TenantId));

            var mapping = GetMappings();
            _configuration.AddDeserializedMapping(mapping, "schema");
            SchemaMetadataUpdater.QuoteTableAndColumns(_configuration);
            new SchemaExport(_configuration).SetOutputFile(@"c:\temp\atxc_schema.ddl").Execute(false, false, false);
            _sessionFactoryBuilder = _configuration.BuildSessionFactory();
        }
開發者ID:ChrisMissal,項目名稱:atxc,代碼行數:20,代碼來源:ConfigurationFactory.cs

示例3: GetConfiguration

        public Configuration GetConfiguration()
        {
            var config = new Configuration();

            string configName = "WebNHibernate.config".ToAbsolute();

            config.Configure(configName);

            var filterDef = new FilterDefinition(
                cultureFilter,
                null, // or your default condition
                new Dictionary<string, IType> {{"cultureId", NHibernateUtil.String}},
                false);
            config.AddFilterDefinition(filterDef);

            HbmMapping mapping = NHibernateMappingRepository.GetMappings();
            config.AddDeserializedMapping(mapping, "NHSchemaTest");

            SchemaMetadataUpdater.QuoteTableAndColumns(config);

            return config;
        }
開發者ID:avannini,項目名稱:uisp-mobile,代碼行數:22,代碼來源:NHibernateConfigurationBuilder.cs

示例4: InitializeFilters

		private void InitializeFilters (Configuration cfg) {

			var filterDef = new FilterDefinition (
				"contextFilter",
				null, // or your default condition
				new Dictionary<string, IType> { { "current", NHibernateUtil.Int32 } },
				false);

			cfg.AddFilterDefinition (filterDef);
		
		
		}
開發者ID:devmicrominds,項目名稱:HIS-Project,代碼行數:12,代碼來源:NHibernateSessionManager.cs


注:本文中的NHibernate.Cfg.Configuration.AddFilterDefinition方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。