当前位置: 首页>>代码示例>>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;未经允许,请勿转载。