本文整理汇总了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);
}
示例2: OnModelCreating
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Filter("SecuredByTenant",
(ISecuredByTenant securedByTenant, Guid? securedByTenantId) => securedByTenant.SecuredByTenantId == securedByTenantId,
() => Guid.Empty);
base.OnModelCreating(modelBuilder);
}
示例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);
}
示例4: OnModelCreating
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Filter("MultiTenant", (IMultiTenantEntity d, Guid tenantId) => d.TenantId == tenantId, ()=> this.TenantId);
}
示例5: OnModelCreating
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Filter(AbpDataFilters.SoftDelete, (ISoftDelete d) => d.IsDeleted, false);
}
示例6: OnModelCreating
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Filter("IsDeleted", (ISoftDeletable d) => d.IsDeleted, false);
}
示例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);
}
示例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);
}
示例9: OnModelCreating
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Filter("Status", (IBusinessBase b, int status) => (b.Status != status), () => -1);
base.OnModelCreating(modelBuilder);
}
示例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);
}
示例11: OnModelCreating
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Filter<ISoftDelete, bool>(FiltersEnum.SoftDelete.ToString(), entity => entity.IsDeleted, false);
}