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


C# DbModelBuilder.Filter方法代码示例

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


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

示例1: OnModelCreating

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Filter("IsDeleted", (DomainModelBase modelBase) => modelBase.IsDeleted, false);

            modelBuilder.Filter("IsDisable", (Account account) => account.IsDisable, false);


            base.OnModelCreating(modelBuilder);
        }
开发者ID:haoxiaofan,项目名称:NewCRM-v1.0,代码行数:9,代码来源:NewCrmBackSite.cs

示例2: OnModelCreating

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {

            modelBuilder.Filter("SecuredByTenant",
                (ISecuredByTenant securedByTenant, Guid? securedByTenantId) => securedByTenant.SecuredByTenantId == securedByTenantId,
                () => Guid.Empty);

            base.OnModelCreating(modelBuilder);
        }
开发者ID:newsoftinc,项目名称:Newsoft.Sample.RowLevelSecurity,代码行数:9,代码来源:TenantAwareDbContext.cs

示例3: OnModelCreating

 protected override void OnModelCreating(DbModelBuilder modelBuilder)
 {
     base.OnModelCreating(modelBuilder);
     modelBuilder.Filter(AbpDataFilters.SoftDelete, (ISoftDelete d) => d.IsDeleted, false);
     modelBuilder.Filter(AbpDataFilters.MustHaveTenant, (IMustHaveTenant t, int tenantId) => t.TenantId == tenantId || (int?)t.TenantId == null, 0);
     modelBuilder.Filter(AbpDataFilters.MayHaveTenant, (IMayHaveTenant t, int? tenantId) => t.TenantId == tenantId, 0);
 }
开发者ID:Zbun,项目名称:Gld.Activity.Project,代码行数:7,代码来源:AbpDbContext.cs

示例4: OnModelCreating

 protected override void OnModelCreating(DbModelBuilder modelBuilder)
 {
     base.OnModelCreating(modelBuilder);
     modelBuilder.Filter("MultiTenant", (IMultiTenantEntity d, Guid tenantId) => d.TenantId == tenantId, ()=> this.TenantId);
 }
开发者ID:dmanning23,项目名称:PocketBoss,代码行数:5,代码来源:MultiTenantDbContextBase.cs

示例5: OnModelCreating

 protected override void OnModelCreating(DbModelBuilder modelBuilder)
 {
     base.OnModelCreating(modelBuilder);
     modelBuilder.Filter(AbpDataFilters.SoftDelete, (ISoftDelete d) => d.IsDeleted, false);
 }
开发者ID:mlkj,项目名称:2016YL.MaterialSystem,代码行数:5,代码来源:AbpDbContext.cs

示例6: OnModelCreating

 protected override void OnModelCreating(DbModelBuilder modelBuilder)
 {
     modelBuilder.Filter("IsDeleted", (ISoftDeletable d) => d.IsDeleted, false);
 }
开发者ID:annmasalskaya,项目名称:SyncFramework,代码行数:4,代码来源:SFDbContext.cs

示例7: OnModelCreating

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            //We use only singular form for table names
            modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();

            //We do not delete, so it is safe to remove - convention creates problems with ScenarioUnit
            modelBuilder.Conventions.Remove<OneToManyCascadeDeleteConvention>();

            //default schema - core
            modelBuilder.HasDefaultSchema("core");

            //default decimal -> (18, 10) (to be confirmed)
            modelBuilder.Properties<decimal>()
                .Configure(config => config.HasPrecision(18, 10));

            //default date time is datetime2 to be compatible with .NET
            modelBuilder.Properties<DateTime>()
                .Configure(config => config.HasColumnType("datetime2"));

            //default string type is varchar, so unicode is not supported
            modelBuilder.Properties<String>()
                .Configure(config => config.HasColumnType("varchar"));

            //filter for the given date data - always on
            modelBuilder.Filter(AsOfFilter, (TemporalAndAudit ta, DateTime dt) => (ta.EndTime > dt && ta.StartTime <= dt), AsOfDate);
            modelBuilder.Filter(ApprovedFilter, (TemporalAndAudit ta, DateTime dt) => (ta.ApprovedAt <= dt), AsOfDate);
        }
开发者ID:Juliusz,项目名称:Test,代码行数:27,代码来源:ScenarioGeneratorModel.cs

示例8: OnModelCreating

 protected override void OnModelCreating(DbModelBuilder modelBuilder)
 {
     base.OnModelCreating(modelBuilder);
     modelBuilder.Filter(AbpDataFilters.SoftDelete, (ISoftDelete d) => d.IsDeleted, false);
     modelBuilder.Filter(AbpDataFilters.MustHaveTenant, (IMustHaveTenant t, int tenantId) => t.TenantId == tenantId || (int?)t.TenantId == null, 0); //While "(int?)t.TenantId == null" seems wrong, it's needed. See https://github.com/jcachat/EntityFramework.DynamicFilters/issues/62#issuecomment-208198058
     modelBuilder.Filter(AbpDataFilters.MayHaveTenant, (IMayHaveTenant t, int? tenantId) => t.TenantId == tenantId, 0);
 }
开发者ID:sessionliang,项目名称:aspnetboilerplate,代码行数:7,代码来源:AbpDbContext.cs

示例9: OnModelCreating

 protected override void OnModelCreating(DbModelBuilder modelBuilder)
 {
     modelBuilder.Filter("Status", (IBusinessBase b, int status) => (b.Status != status), () => -1);
     base.OnModelCreating(modelBuilder);
 }
开发者ID:thornfieldhe,项目名称:TAF,代码行数:5,代码来源:TAFContext.cs

示例10: OnModelCreating

 protected override void OnModelCreating(DbModelBuilder modelBuilder)
 {
     base.OnModelCreating(modelBuilder);
     //modelBuilder.Filter(AbpDataFilters.SoftDelete, (ISoftDelete d) => d.IsDeleted, false);
     modelBuilder.Filter(AbpDataFilters.SoftDelete, (ISoftDelete d, bool isDeleted) => d.IsDeleted == isDeleted, false);//20150915HW为了过滤出已删除的记录而加入此行
     modelBuilder.Filter(AbpDataFilters.MustHaveTenant, (IMustHaveTenant t, int tenantId) => t.TenantId == tenantId, 0);
     modelBuilder.Filter(AbpDataFilters.MayHaveTenant, (IMayHaveTenant t, int? tenantId) => t.TenantId == tenantId, 0);
 }
开发者ID:AndHuang,项目名称:aspnetboilerplate,代码行数:8,代码来源:AbpDbContext.cs

示例11: OnModelCreating

 protected override void OnModelCreating(DbModelBuilder modelBuilder)
 {
     modelBuilder.Filter<ISoftDelete, bool>(FiltersEnum.SoftDelete.ToString(), entity => entity.IsDeleted, false);
 }
开发者ID:BeiMeng,项目名称:BeiDream,代码行数:4,代码来源:DbContextBase.cs


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