EntityFramework.DynamicFilters
EntityFramework.DynamicFilters copied to clipboard
System.NotImplementedException: AlterTableOperation
I'm trying to use EntityFramework.DynamicFilters for soft delete, and all entities for soft delete are implemented from BaseEntity.
modelBuilder.Filter("SoftDelete", (BaseEntity e) => e.DeleteMark, false);
The code blow works good until I add the filter into OnModelCreating,It throws System.NotImplementedException: AlterTableOperation.
using (var db = new FrameworkDbContext()) { db.Database.Initialize(false); }
Why the filter will cause this exception,and how to solve it?
Hello @hoxcape ,
Which database provider are you using?
Unfortunately, by changing / adding some filtering, it happens that script migration get required.
Let me know the provider you are using and if you can provide a short full example to let me try faster this issue.
Best Regards,
Jonathan
If the database is Postgres, this issue was previously reported as issue #60. There is information there that may be helpful and a possible solution. It is an issue with the Postgres EF provider.
@JonathanMagnan , I'm using MySQL database,and the provider is MySql.Data.MySqlClient.I enabled AutoMigration for develop time,then I generated a migration file after inserted filters into OnModelCreating, I found a Up action named AlterTableAnnotations.
namespace Guolian.ERPFramework.DbContext.Migrations
{
using System;
using System.Collections.Generic;
using System.Data.Entity.Infrastructure.Annotations;
using System.Data.Entity.Migrations;
public partial class test : DbMigration
{
public override void Up()
{
AlterTableAnnotations(
"dbo.Departments",
c => new
{
Id = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
DepartmentName = c.String(unicode: false),
Address = c.String(unicode: false),
Contact = c.String(unicode: false),
ParentDepartmentId = c.String(maxLength: 120, storeType: "nvarchar"),
SortCode = c.Int(nullable: false),
DeleteMark = c.Boolean(nullable: false),
CreateUserId = c.String(maxLength: 120, storeType: "nvarchar"),
ModifierId = c.String(maxLength: 120, storeType: "nvarchar"),
DeleteUserId = c.String(maxLength: 120, storeType: "nvarchar"),
CreateDate = c.DateTime(nullable: false, precision: 0),
ModifyDate = c.DateTime(nullable: false, precision: 0),
DeleteDate = c.DateTime(nullable: false, precision: 0),
Remark = c.String(unicode: false),
},
annotations: new Dictionary<string, AnnotationValues>
{
{
"DynamicFilter_Department_LogicDelete",
new AnnotationValues(oldValue: null, newValue: "EntityFramework.DynamicFilters.DynamicFilterDefinition")
},
});
AlterTableAnnotations(
"dbo.Users",
c => new
{
Id = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
DepartmentId = c.String(maxLength: 120, storeType: "nvarchar"),
Account = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
Name = c.String(maxLength: 120, storeType: "nvarchar"),
Email = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
Tel = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
Sex = c.Int(nullable: false),
Position = c.String(maxLength: 120, storeType: "nvarchar"),
Age = c.Int(nullable: false),
Address = c.String(maxLength: 120, storeType: "nvarchar"),
RoleId = c.String(maxLength: 120, storeType: "nvarchar"),
PasswordExpired = c.Boolean(nullable: false),
SortCode = c.Int(nullable: false),
DeleteMark = c.Boolean(nullable: false),
CreateUserId = c.String(maxLength: 120, storeType: "nvarchar"),
ModifierId = c.String(maxLength: 120, storeType: "nvarchar"),
DeleteUserId = c.String(maxLength: 120, storeType: "nvarchar"),
CreateDate = c.DateTime(nullable: false, precision: 0),
ModifyDate = c.DateTime(nullable: false, precision: 0),
DeleteDate = c.DateTime(nullable: false, precision: 0),
Remark = c.String(unicode: false),
},
annotations: new Dictionary<string, AnnotationValues>
{
{
"DynamicFilter_User_LogicDelete",
new AnnotationValues(oldValue: null, newValue: "EntityFramework.DynamicFilters.DynamicFilterDefinition")
},
});
AlterTableAnnotations(
"dbo.Roles",
c => new
{
Id = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
Name = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
SortCode = c.Int(nullable: false),
DeleteMark = c.Boolean(nullable: false),
CreateUserId = c.String(maxLength: 120, storeType: "nvarchar"),
ModifierId = c.String(maxLength: 120, storeType: "nvarchar"),
DeleteUserId = c.String(maxLength: 120, storeType: "nvarchar"),
CreateDate = c.DateTime(nullable: false, precision: 0),
ModifyDate = c.DateTime(nullable: false, precision: 0),
DeleteDate = c.DateTime(nullable: false, precision: 0),
Remark = c.String(unicode: false),
},
annotations: new Dictionary<string, AnnotationValues>
{
{
"DynamicFilter_Role_LogicDelete",
new AnnotationValues(oldValue: null, newValue: "EntityFramework.DynamicFilters.DynamicFilterDefinition")
},
});
AlterTableAnnotations(
"dbo.ExceptionLogs",
c => new
{
Id = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
Position = c.String(unicode: false),
Message = c.String(unicode: false),
Stack = c.String(unicode: false),
ExceptionLevel = c.Int(nullable: false),
OtherInfo = c.String(unicode: false),
RemoteIP = c.String(unicode: false),
ExceptionTime = c.DateTime(nullable: false, precision: 0),
SortCode = c.Int(nullable: false),
DeleteMark = c.Boolean(nullable: false),
CreateUserId = c.String(maxLength: 120, storeType: "nvarchar"),
ModifierId = c.String(maxLength: 120, storeType: "nvarchar"),
DeleteUserId = c.String(maxLength: 120, storeType: "nvarchar"),
CreateDate = c.DateTime(nullable: false, precision: 0),
ModifyDate = c.DateTime(nullable: false, precision: 0),
DeleteDate = c.DateTime(nullable: false, precision: 0),
Remark = c.String(unicode: false),
},
annotations: new Dictionary<string, AnnotationValues>
{
{
"DynamicFilter_ExceptionLog_LogicDelete",
new AnnotationValues(oldValue: null, newValue: "EntityFramework.DynamicFilters.DynamicFilterDefinition")
},
});
AlterTableAnnotations(
"dbo.GoodsInfoes",
c => new
{
Id = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
Name = c.String(nullable: false, unicode: false),
Code = c.String(nullable: false, unicode: false),
CategoryId = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
StockRemind = c.Decimal(nullable: false, precision: 18, scale: 2),
UnitId = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
SortCode = c.Int(nullable: false),
DeleteMark = c.Boolean(nullable: false),
CreateUserId = c.String(maxLength: 120, storeType: "nvarchar"),
ModifierId = c.String(maxLength: 120, storeType: "nvarchar"),
DeleteUserId = c.String(maxLength: 120, storeType: "nvarchar"),
CreateDate = c.DateTime(nullable: false, precision: 0),
ModifyDate = c.DateTime(nullable: false, precision: 0),
DeleteDate = c.DateTime(nullable: false, precision: 0),
Remark = c.String(unicode: false),
},
annotations: new Dictionary<string, AnnotationValues>
{
{
"DynamicFilter_GoodsInfo_LogicDelete",
new AnnotationValues(oldValue: null, newValue: "EntityFramework.DynamicFilters.DynamicFilterDefinition")
},
});
AlterTableAnnotations(
"dbo.GoodsCategories",
c => new
{
Id = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
CategoryName = c.String(nullable: false, unicode: false),
SortCode = c.Int(nullable: false),
DeleteMark = c.Boolean(nullable: false),
CreateUserId = c.String(maxLength: 120, storeType: "nvarchar"),
ModifierId = c.String(maxLength: 120, storeType: "nvarchar"),
DeleteUserId = c.String(maxLength: 120, storeType: "nvarchar"),
CreateDate = c.DateTime(nullable: false, precision: 0),
ModifyDate = c.DateTime(nullable: false, precision: 0),
DeleteDate = c.DateTime(nullable: false, precision: 0),
Remark = c.String(unicode: false),
},
annotations: new Dictionary<string, AnnotationValues>
{
{
"DynamicFilter_GoodsCategory_LogicDelete",
new AnnotationValues(oldValue: null, newValue: "EntityFramework.DynamicFilters.DynamicFilterDefinition")
},
});
AlterTableAnnotations(
"dbo.GoodsUnits",
c => new
{
Id = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
Name = c.String(nullable: false, unicode: false),
SortCode = c.Int(nullable: false),
DeleteMark = c.Boolean(nullable: false),
CreateUserId = c.String(maxLength: 120, storeType: "nvarchar"),
ModifierId = c.String(maxLength: 120, storeType: "nvarchar"),
DeleteUserId = c.String(maxLength: 120, storeType: "nvarchar"),
CreateDate = c.DateTime(nullable: false, precision: 0),
ModifyDate = c.DateTime(nullable: false, precision: 0),
DeleteDate = c.DateTime(nullable: false, precision: 0),
Remark = c.String(unicode: false),
},
annotations: new Dictionary<string, AnnotationValues>
{
{
"DynamicFilter_GoodsUnit_LogicDelete",
new AnnotationValues(oldValue: null, newValue: "EntityFramework.DynamicFilters.DynamicFilterDefinition")
},
});
AlterTableAnnotations(
"dbo.GoodsVersions",
c => new
{
Id = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
GoodsInfoId = c.String(maxLength: 120, storeType: "nvarchar"),
SupplierId = c.String(maxLength: 120, storeType: "nvarchar"),
Price = c.Decimal(nullable: false, precision: 18, scale: 2),
Percentage = c.Decimal(nullable: false, precision: 18, scale: 2),
ParentGoodsVersionId = c.String(maxLength: 120, storeType: "nvarchar"),
SortCode = c.Int(nullable: false),
DeleteMark = c.Boolean(nullable: false),
CreateUserId = c.String(maxLength: 120, storeType: "nvarchar"),
ModifierId = c.String(maxLength: 120, storeType: "nvarchar"),
DeleteUserId = c.String(maxLength: 120, storeType: "nvarchar"),
CreateDate = c.DateTime(nullable: false, precision: 0),
ModifyDate = c.DateTime(nullable: false, precision: 0),
DeleteDate = c.DateTime(nullable: false, precision: 0),
Remark = c.String(unicode: false),
},
annotations: new Dictionary<string, AnnotationValues>
{
{
"DynamicFilter_GoodsVersion_LogicDelete",
new AnnotationValues(oldValue: null, newValue: "EntityFramework.DynamicFilters.DynamicFilterDefinition")
},
});
AlterTableAnnotations(
"dbo.StockChanges",
c => new
{
Id = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
GoodsVersionId = c.String(maxLength: 120, storeType: "nvarchar"),
GoodsCount = c.Decimal(nullable: false, precision: 18, scale: 2),
Type = c.Int(nullable: false),
DepartmentId = c.String(maxLength: 120, storeType: "nvarchar"),
SortCode = c.Int(nullable: false),
DeleteMark = c.Boolean(nullable: false),
CreateUserId = c.String(maxLength: 120, storeType: "nvarchar"),
ModifierId = c.String(maxLength: 120, storeType: "nvarchar"),
DeleteUserId = c.String(maxLength: 120, storeType: "nvarchar"),
CreateDate = c.DateTime(nullable: false, precision: 0),
ModifyDate = c.DateTime(nullable: false, precision: 0),
DeleteDate = c.DateTime(nullable: false, precision: 0),
Remark = c.String(unicode: false),
},
annotations: new Dictionary<string, AnnotationValues>
{
{
"DynamicFilter_StockChange_LogicDelete",
new AnnotationValues(oldValue: null, newValue: "EntityFramework.DynamicFilters.DynamicFilterDefinition")
},
});
AlterTableAnnotations(
"dbo.Suppliers",
c => new
{
Id = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
Name = c.String(unicode: false),
Contact = c.String(unicode: false),
Tel = c.String(unicode: false),
Address = c.String(unicode: false),
SortCode = c.Int(nullable: false),
DeleteMark = c.Boolean(nullable: false),
CreateUserId = c.String(maxLength: 120, storeType: "nvarchar"),
ModifierId = c.String(maxLength: 120, storeType: "nvarchar"),
DeleteUserId = c.String(maxLength: 120, storeType: "nvarchar"),
CreateDate = c.DateTime(nullable: false, precision: 0),
ModifyDate = c.DateTime(nullable: false, precision: 0),
DeleteDate = c.DateTime(nullable: false, precision: 0),
Remark = c.String(unicode: false),
},
annotations: new Dictionary<string, AnnotationValues>
{
{
"DynamicFilter_Supplier_LogicDelete",
new AnnotationValues(oldValue: null, newValue: "EntityFramework.DynamicFilters.DynamicFilterDefinition")
},
});
AlterTableAnnotations(
"dbo.InStocks",
c => new
{
Id = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
Count = c.Decimal(nullable: false, precision: 18, scale: 2),
TotalPrice = c.Decimal(nullable: false, precision: 18, scale: 2),
SortCode = c.Int(nullable: false),
DeleteMark = c.Boolean(nullable: false),
CreateUserId = c.String(maxLength: 120, storeType: "nvarchar"),
ModifierId = c.String(maxLength: 120, storeType: "nvarchar"),
DeleteUserId = c.String(maxLength: 120, storeType: "nvarchar"),
CreateDate = c.DateTime(nullable: false, precision: 0),
ModifyDate = c.DateTime(nullable: false, precision: 0),
DeleteDate = c.DateTime(nullable: false, precision: 0),
Remark = c.String(unicode: false),
},
annotations: new Dictionary<string, AnnotationValues>
{
{
"DynamicFilter_InStock_LogicDelete",
new AnnotationValues(oldValue: null, newValue: "EntityFramework.DynamicFilters.DynamicFilterDefinition")
},
});
AlterTableAnnotations(
"dbo.InStockDetails",
c => new
{
Id = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
OrderId = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
GoodsVersionId = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
Count = c.Decimal(nullable: false, precision: 18, scale: 2),
TotalPrice = c.Decimal(nullable: false, precision: 18, scale: 2),
SortCode = c.Int(nullable: false),
DeleteMark = c.Boolean(nullable: false),
CreateUserId = c.String(maxLength: 120, storeType: "nvarchar"),
ModifierId = c.String(maxLength: 120, storeType: "nvarchar"),
DeleteUserId = c.String(maxLength: 120, storeType: "nvarchar"),
CreateDate = c.DateTime(nullable: false, precision: 0),
ModifyDate = c.DateTime(nullable: false, precision: 0),
DeleteDate = c.DateTime(nullable: false, precision: 0),
Remark = c.String(unicode: false),
},
annotations: new Dictionary<string, AnnotationValues>
{
{
"DynamicFilter_InStockDetail_LogicDelete",
new AnnotationValues(oldValue: null, newValue: "EntityFramework.DynamicFilters.DynamicFilterDefinition")
},
});
AlterTableAnnotations(
"dbo.OperationLogs",
c => new
{
Id = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
Position = c.String(unicode: false),
Type = c.String(unicode: false),
Description = c.String(unicode: false),
RemoteIP = c.String(unicode: false),
OperatorId = c.String(maxLength: 120, storeType: "nvarchar"),
DepartmentID = c.String(maxLength: 120, storeType: "nvarchar"),
OperateTime = c.DateTime(nullable: false, precision: 0),
SortCode = c.Int(nullable: false),
DeleteMark = c.Boolean(nullable: false),
CreateUserId = c.String(maxLength: 120, storeType: "nvarchar"),
ModifierId = c.String(maxLength: 120, storeType: "nvarchar"),
DeleteUserId = c.String(maxLength: 120, storeType: "nvarchar"),
CreateDate = c.DateTime(nullable: false, precision: 0),
ModifyDate = c.DateTime(nullable: false, precision: 0),
DeleteDate = c.DateTime(nullable: false, precision: 0),
Remark = c.String(unicode: false),
},
annotations: new Dictionary<string, AnnotationValues>
{
{
"DynamicFilter_OperationLog_LogicDelete",
new AnnotationValues(oldValue: null, newValue: "EntityFramework.DynamicFilters.DynamicFilterDefinition")
},
});
AlterTableAnnotations(
"dbo.SaleBills",
c => new
{
Id = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
OrderId = c.String(nullable: false, unicode: false),
Count = c.Decimal(nullable: false, precision: 18, scale: 2),
TotalPrice = c.Decimal(nullable: false, precision: 18, scale: 2),
DepartmentId = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
PaymentType = c.String(unicode: false),
Pay = c.Decimal(nullable: false, precision: 18, scale: 2),
SortCode = c.Int(nullable: false),
DeleteMark = c.Boolean(nullable: false),
CreateUserId = c.String(maxLength: 120, storeType: "nvarchar"),
ModifierId = c.String(maxLength: 120, storeType: "nvarchar"),
DeleteUserId = c.String(maxLength: 120, storeType: "nvarchar"),
CreateDate = c.DateTime(nullable: false, precision: 0),
ModifyDate = c.DateTime(nullable: false, precision: 0),
DeleteDate = c.DateTime(nullable: false, precision: 0),
Remark = c.String(unicode: false),
},
annotations: new Dictionary<string, AnnotationValues>
{
{
"DynamicFilter_SaleBill_LogicDelete",
new AnnotationValues(oldValue: null, newValue: "EntityFramework.DynamicFilters.DynamicFilterDefinition")
},
});
AlterTableAnnotations(
"dbo.SaleBillDetails",
c => new
{
Id = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
OrderId = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
Count = c.Decimal(nullable: false, precision: 18, scale: 2),
TotalPrice = c.Decimal(nullable: false, precision: 18, scale: 2),
StockId = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
SortCode = c.Int(nullable: false),
DeleteMark = c.Boolean(nullable: false),
CreateUserId = c.String(maxLength: 120, storeType: "nvarchar"),
ModifierId = c.String(maxLength: 120, storeType: "nvarchar"),
DeleteUserId = c.String(maxLength: 120, storeType: "nvarchar"),
CreateDate = c.DateTime(nullable: false, precision: 0),
ModifyDate = c.DateTime(nullable: false, precision: 0),
DeleteDate = c.DateTime(nullable: false, precision: 0),
Remark = c.String(unicode: false),
},
annotations: new Dictionary<string, AnnotationValues>
{
{
"DynamicFilter_SaleBillDetail_LogicDelete",
new AnnotationValues(oldValue: null, newValue: "EntityFramework.DynamicFilters.DynamicFilterDefinition")
},
});
AlterTableAnnotations(
"dbo.StockChangeRecords",
c => new
{
Id = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
OldStockId = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
OldGoodsVersionId = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
NewStockId = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
NewGoodsVersionId = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
SortCode = c.Int(nullable: false),
DeleteMark = c.Boolean(nullable: false),
CreateUserId = c.String(maxLength: 120, storeType: "nvarchar"),
ModifierId = c.String(maxLength: 120, storeType: "nvarchar"),
DeleteUserId = c.String(maxLength: 120, storeType: "nvarchar"),
CreateDate = c.DateTime(nullable: false, precision: 0),
ModifyDate = c.DateTime(nullable: false, precision: 0),
DeleteDate = c.DateTime(nullable: false, precision: 0),
Remark = c.String(unicode: false),
},
annotations: new Dictionary<string, AnnotationValues>
{
{
"DynamicFilter_StockChangeRecord_LogicDelete",
new AnnotationValues(oldValue: null, newValue: "EntityFramework.DynamicFilters.DynamicFilterDefinition")
},
});
AlterTableAnnotations(
"dbo.SupplierCashes",
c => new
{
Id = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
SupplierId = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
DepartmentId = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
Count = c.Decimal(nullable: false, precision: 18, scale: 2),
TotalPrice = c.Decimal(nullable: false, precision: 18, scale: 2),
Cash = c.Decimal(nullable: false, precision: 18, scale: 2),
SortCode = c.Int(nullable: false),
DeleteMark = c.Boolean(nullable: false),
CreateUserId = c.String(maxLength: 120, storeType: "nvarchar"),
ModifierId = c.String(maxLength: 120, storeType: "nvarchar"),
DeleteUserId = c.String(maxLength: 120, storeType: "nvarchar"),
CreateDate = c.DateTime(nullable: false, precision: 0),
ModifyDate = c.DateTime(nullable: false, precision: 0),
DeleteDate = c.DateTime(nullable: false, precision: 0),
Remark = c.String(unicode: false),
},
annotations: new Dictionary<string, AnnotationValues>
{
{
"DynamicFilter_SupplierCash_LogicDelete",
new AnnotationValues(oldValue: null, newValue: "EntityFramework.DynamicFilters.DynamicFilterDefinition")
},
});
AlterTableAnnotations(
"dbo.SupplierCashDetails",
c => new
{
Id = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
OrderId = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
InStockDetailId = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
Count = c.Decimal(nullable: false, precision: 18, scale: 2),
Cash = c.Decimal(nullable: false, precision: 18, scale: 2),
SortCode = c.Int(nullable: false),
DeleteMark = c.Boolean(nullable: false),
CreateUserId = c.String(maxLength: 120, storeType: "nvarchar"),
ModifierId = c.String(maxLength: 120, storeType: "nvarchar"),
DeleteUserId = c.String(maxLength: 120, storeType: "nvarchar"),
CreateDate = c.DateTime(nullable: false, precision: 0),
ModifyDate = c.DateTime(nullable: false, precision: 0),
DeleteDate = c.DateTime(nullable: false, precision: 0),
Remark = c.String(unicode: false),
},
annotations: new Dictionary<string, AnnotationValues>
{
{
"DynamicFilter_SupplierCashDetail_LogicDelete",
new AnnotationValues(oldValue: null, newValue: "EntityFramework.DynamicFilters.DynamicFilterDefinition")
},
});
}
public override void Down()
{
AlterTableAnnotations(
"dbo.SupplierCashDetails",
c => new
{
Id = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
OrderId = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
InStockDetailId = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
Count = c.Decimal(nullable: false, precision: 18, scale: 2),
Cash = c.Decimal(nullable: false, precision: 18, scale: 2),
SortCode = c.Int(nullable: false),
DeleteMark = c.Boolean(nullable: false),
CreateUserId = c.String(maxLength: 120, storeType: "nvarchar"),
ModifierId = c.String(maxLength: 120, storeType: "nvarchar"),
DeleteUserId = c.String(maxLength: 120, storeType: "nvarchar"),
CreateDate = c.DateTime(nullable: false, precision: 0),
ModifyDate = c.DateTime(nullable: false, precision: 0),
DeleteDate = c.DateTime(nullable: false, precision: 0),
Remark = c.String(unicode: false),
},
annotations: new Dictionary<string, AnnotationValues>
{
{
"DynamicFilter_SupplierCashDetail_LogicDelete",
new AnnotationValues(oldValue: "EntityFramework.DynamicFilters.DynamicFilterDefinition", newValue: null)
},
});
AlterTableAnnotations(
"dbo.SupplierCashes",
c => new
{
Id = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
SupplierId = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
DepartmentId = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
Count = c.Decimal(nullable: false, precision: 18, scale: 2),
TotalPrice = c.Decimal(nullable: false, precision: 18, scale: 2),
Cash = c.Decimal(nullable: false, precision: 18, scale: 2),
SortCode = c.Int(nullable: false),
DeleteMark = c.Boolean(nullable: false),
CreateUserId = c.String(maxLength: 120, storeType: "nvarchar"),
ModifierId = c.String(maxLength: 120, storeType: "nvarchar"),
DeleteUserId = c.String(maxLength: 120, storeType: "nvarchar"),
CreateDate = c.DateTime(nullable: false, precision: 0),
ModifyDate = c.DateTime(nullable: false, precision: 0),
DeleteDate = c.DateTime(nullable: false, precision: 0),
Remark = c.String(unicode: false),
},
annotations: new Dictionary<string, AnnotationValues>
{
{
"DynamicFilter_SupplierCash_LogicDelete",
new AnnotationValues(oldValue: "EntityFramework.DynamicFilters.DynamicFilterDefinition", newValue: null)
},
});
AlterTableAnnotations(
"dbo.StockChangeRecords",
c => new
{
Id = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
OldStockId = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
OldGoodsVersionId = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
NewStockId = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
NewGoodsVersionId = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
SortCode = c.Int(nullable: false),
DeleteMark = c.Boolean(nullable: false),
CreateUserId = c.String(maxLength: 120, storeType: "nvarchar"),
ModifierId = c.String(maxLength: 120, storeType: "nvarchar"),
DeleteUserId = c.String(maxLength: 120, storeType: "nvarchar"),
CreateDate = c.DateTime(nullable: false, precision: 0),
ModifyDate = c.DateTime(nullable: false, precision: 0),
DeleteDate = c.DateTime(nullable: false, precision: 0),
Remark = c.String(unicode: false),
},
annotations: new Dictionary<string, AnnotationValues>
{
{
"DynamicFilter_StockChangeRecord_LogicDelete",
new AnnotationValues(oldValue: "EntityFramework.DynamicFilters.DynamicFilterDefinition", newValue: null)
},
});
AlterTableAnnotations(
"dbo.SaleBillDetails",
c => new
{
Id = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
OrderId = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
Count = c.Decimal(nullable: false, precision: 18, scale: 2),
TotalPrice = c.Decimal(nullable: false, precision: 18, scale: 2),
StockId = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
SortCode = c.Int(nullable: false),
DeleteMark = c.Boolean(nullable: false),
CreateUserId = c.String(maxLength: 120, storeType: "nvarchar"),
ModifierId = c.String(maxLength: 120, storeType: "nvarchar"),
DeleteUserId = c.String(maxLength: 120, storeType: "nvarchar"),
CreateDate = c.DateTime(nullable: false, precision: 0),
ModifyDate = c.DateTime(nullable: false, precision: 0),
DeleteDate = c.DateTime(nullable: false, precision: 0),
Remark = c.String(unicode: false),
},
annotations: new Dictionary<string, AnnotationValues>
{
{
"DynamicFilter_SaleBillDetail_LogicDelete",
new AnnotationValues(oldValue: "EntityFramework.DynamicFilters.DynamicFilterDefinition", newValue: null)
},
});
AlterTableAnnotations(
"dbo.SaleBills",
c => new
{
Id = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
OrderId = c.String(nullable: false, unicode: false),
Count = c.Decimal(nullable: false, precision: 18, scale: 2),
TotalPrice = c.Decimal(nullable: false, precision: 18, scale: 2),
DepartmentId = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
PaymentType = c.String(unicode: false),
Pay = c.Decimal(nullable: false, precision: 18, scale: 2),
SortCode = c.Int(nullable: false),
DeleteMark = c.Boolean(nullable: false),
CreateUserId = c.String(maxLength: 120, storeType: "nvarchar"),
ModifierId = c.String(maxLength: 120, storeType: "nvarchar"),
DeleteUserId = c.String(maxLength: 120, storeType: "nvarchar"),
CreateDate = c.DateTime(nullable: false, precision: 0),
ModifyDate = c.DateTime(nullable: false, precision: 0),
DeleteDate = c.DateTime(nullable: false, precision: 0),
Remark = c.String(unicode: false),
},
annotations: new Dictionary<string, AnnotationValues>
{
{
"DynamicFilter_SaleBill_LogicDelete",
new AnnotationValues(oldValue: "EntityFramework.DynamicFilters.DynamicFilterDefinition", newValue: null)
},
});
AlterTableAnnotations(
"dbo.OperationLogs",
c => new
{
Id = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
Position = c.String(unicode: false),
Type = c.String(unicode: false),
Description = c.String(unicode: false),
RemoteIP = c.String(unicode: false),
OperatorId = c.String(maxLength: 120, storeType: "nvarchar"),
DepartmentID = c.String(maxLength: 120, storeType: "nvarchar"),
OperateTime = c.DateTime(nullable: false, precision: 0),
SortCode = c.Int(nullable: false),
DeleteMark = c.Boolean(nullable: false),
CreateUserId = c.String(maxLength: 120, storeType: "nvarchar"),
ModifierId = c.String(maxLength: 120, storeType: "nvarchar"),
DeleteUserId = c.String(maxLength: 120, storeType: "nvarchar"),
CreateDate = c.DateTime(nullable: false, precision: 0),
ModifyDate = c.DateTime(nullable: false, precision: 0),
DeleteDate = c.DateTime(nullable: false, precision: 0),
Remark = c.String(unicode: false),
},
annotations: new Dictionary<string, AnnotationValues>
{
{
"DynamicFilter_OperationLog_LogicDelete",
new AnnotationValues(oldValue: "EntityFramework.DynamicFilters.DynamicFilterDefinition", newValue: null)
},
});
AlterTableAnnotations(
"dbo.InStockDetails",
c => new
{
Id = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
OrderId = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
GoodsVersionId = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
Count = c.Decimal(nullable: false, precision: 18, scale: 2),
TotalPrice = c.Decimal(nullable: false, precision: 18, scale: 2),
SortCode = c.Int(nullable: false),
DeleteMark = c.Boolean(nullable: false),
CreateUserId = c.String(maxLength: 120, storeType: "nvarchar"),
ModifierId = c.String(maxLength: 120, storeType: "nvarchar"),
DeleteUserId = c.String(maxLength: 120, storeType: "nvarchar"),
CreateDate = c.DateTime(nullable: false, precision: 0),
ModifyDate = c.DateTime(nullable: false, precision: 0),
DeleteDate = c.DateTime(nullable: false, precision: 0),
Remark = c.String(unicode: false),
},
annotations: new Dictionary<string, AnnotationValues>
{
{
"DynamicFilter_InStockDetail_LogicDelete",
new AnnotationValues(oldValue: "EntityFramework.DynamicFilters.DynamicFilterDefinition", newValue: null)
},
});
AlterTableAnnotations(
"dbo.InStocks",
c => new
{
Id = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
Count = c.Decimal(nullable: false, precision: 18, scale: 2),
TotalPrice = c.Decimal(nullable: false, precision: 18, scale: 2),
SortCode = c.Int(nullable: false),
DeleteMark = c.Boolean(nullable: false),
CreateUserId = c.String(maxLength: 120, storeType: "nvarchar"),
ModifierId = c.String(maxLength: 120, storeType: "nvarchar"),
DeleteUserId = c.String(maxLength: 120, storeType: "nvarchar"),
CreateDate = c.DateTime(nullable: false, precision: 0),
ModifyDate = c.DateTime(nullable: false, precision: 0),
DeleteDate = c.DateTime(nullable: false, precision: 0),
Remark = c.String(unicode: false),
},
annotations: new Dictionary<string, AnnotationValues>
{
{
"DynamicFilter_InStock_LogicDelete",
new AnnotationValues(oldValue: "EntityFramework.DynamicFilters.DynamicFilterDefinition", newValue: null)
},
});
AlterTableAnnotations(
"dbo.Suppliers",
c => new
{
Id = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
Name = c.String(unicode: false),
Contact = c.String(unicode: false),
Tel = c.String(unicode: false),
Address = c.String(unicode: false),
SortCode = c.Int(nullable: false),
DeleteMark = c.Boolean(nullable: false),
CreateUserId = c.String(maxLength: 120, storeType: "nvarchar"),
ModifierId = c.String(maxLength: 120, storeType: "nvarchar"),
DeleteUserId = c.String(maxLength: 120, storeType: "nvarchar"),
CreateDate = c.DateTime(nullable: false, precision: 0),
ModifyDate = c.DateTime(nullable: false, precision: 0),
DeleteDate = c.DateTime(nullable: false, precision: 0),
Remark = c.String(unicode: false),
},
annotations: new Dictionary<string, AnnotationValues>
{
{
"DynamicFilter_Supplier_LogicDelete",
new AnnotationValues(oldValue: "EntityFramework.DynamicFilters.DynamicFilterDefinition", newValue: null)
},
});
AlterTableAnnotations(
"dbo.StockChanges",
c => new
{
Id = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
GoodsVersionId = c.String(maxLength: 120, storeType: "nvarchar"),
GoodsCount = c.Decimal(nullable: false, precision: 18, scale: 2),
Type = c.Int(nullable: false),
DepartmentId = c.String(maxLength: 120, storeType: "nvarchar"),
SortCode = c.Int(nullable: false),
DeleteMark = c.Boolean(nullable: false),
CreateUserId = c.String(maxLength: 120, storeType: "nvarchar"),
ModifierId = c.String(maxLength: 120, storeType: "nvarchar"),
DeleteUserId = c.String(maxLength: 120, storeType: "nvarchar"),
CreateDate = c.DateTime(nullable: false, precision: 0),
ModifyDate = c.DateTime(nullable: false, precision: 0),
DeleteDate = c.DateTime(nullable: false, precision: 0),
Remark = c.String(unicode: false),
},
annotations: new Dictionary<string, AnnotationValues>
{
{
"DynamicFilter_StockChange_LogicDelete",
new AnnotationValues(oldValue: "EntityFramework.DynamicFilters.DynamicFilterDefinition", newValue: null)
},
});
AlterTableAnnotations(
"dbo.GoodsVersions",
c => new
{
Id = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
GoodsInfoId = c.String(maxLength: 120, storeType: "nvarchar"),
SupplierId = c.String(maxLength: 120, storeType: "nvarchar"),
Price = c.Decimal(nullable: false, precision: 18, scale: 2),
Percentage = c.Decimal(nullable: false, precision: 18, scale: 2),
ParentGoodsVersionId = c.String(maxLength: 120, storeType: "nvarchar"),
SortCode = c.Int(nullable: false),
DeleteMark = c.Boolean(nullable: false),
CreateUserId = c.String(maxLength: 120, storeType: "nvarchar"),
ModifierId = c.String(maxLength: 120, storeType: "nvarchar"),
DeleteUserId = c.String(maxLength: 120, storeType: "nvarchar"),
CreateDate = c.DateTime(nullable: false, precision: 0),
ModifyDate = c.DateTime(nullable: false, precision: 0),
DeleteDate = c.DateTime(nullable: false, precision: 0),
Remark = c.String(unicode: false),
},
annotations: new Dictionary<string, AnnotationValues>
{
{
"DynamicFilter_GoodsVersion_LogicDelete",
new AnnotationValues(oldValue: "EntityFramework.DynamicFilters.DynamicFilterDefinition", newValue: null)
},
});
AlterTableAnnotations(
"dbo.GoodsUnits",
c => new
{
Id = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
Name = c.String(nullable: false, unicode: false),
SortCode = c.Int(nullable: false),
DeleteMark = c.Boolean(nullable: false),
CreateUserId = c.String(maxLength: 120, storeType: "nvarchar"),
ModifierId = c.String(maxLength: 120, storeType: "nvarchar"),
DeleteUserId = c.String(maxLength: 120, storeType: "nvarchar"),
CreateDate = c.DateTime(nullable: false, precision: 0),
ModifyDate = c.DateTime(nullable: false, precision: 0),
DeleteDate = c.DateTime(nullable: false, precision: 0),
Remark = c.String(unicode: false),
},
annotations: new Dictionary<string, AnnotationValues>
{
{
"DynamicFilter_GoodsUnit_LogicDelete",
new AnnotationValues(oldValue: "EntityFramework.DynamicFilters.DynamicFilterDefinition", newValue: null)
},
});
AlterTableAnnotations(
"dbo.GoodsCategories",
c => new
{
Id = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
CategoryName = c.String(nullable: false, unicode: false),
SortCode = c.Int(nullable: false),
DeleteMark = c.Boolean(nullable: false),
CreateUserId = c.String(maxLength: 120, storeType: "nvarchar"),
ModifierId = c.String(maxLength: 120, storeType: "nvarchar"),
DeleteUserId = c.String(maxLength: 120, storeType: "nvarchar"),
CreateDate = c.DateTime(nullable: false, precision: 0),
ModifyDate = c.DateTime(nullable: false, precision: 0),
DeleteDate = c.DateTime(nullable: false, precision: 0),
Remark = c.String(unicode: false),
},
annotations: new Dictionary<string, AnnotationValues>
{
{
"DynamicFilter_GoodsCategory_LogicDelete",
new AnnotationValues(oldValue: "EntityFramework.DynamicFilters.DynamicFilterDefinition", newValue: null)
},
});
AlterTableAnnotations(
"dbo.GoodsInfoes",
c => new
{
Id = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
Name = c.String(nullable: false, unicode: false),
Code = c.String(nullable: false, unicode: false),
CategoryId = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
StockRemind = c.Decimal(nullable: false, precision: 18, scale: 2),
UnitId = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
SortCode = c.Int(nullable: false),
DeleteMark = c.Boolean(nullable: false),
CreateUserId = c.String(maxLength: 120, storeType: "nvarchar"),
ModifierId = c.String(maxLength: 120, storeType: "nvarchar"),
DeleteUserId = c.String(maxLength: 120, storeType: "nvarchar"),
CreateDate = c.DateTime(nullable: false, precision: 0),
ModifyDate = c.DateTime(nullable: false, precision: 0),
DeleteDate = c.DateTime(nullable: false, precision: 0),
Remark = c.String(unicode: false),
},
annotations: new Dictionary<string, AnnotationValues>
{
{
"DynamicFilter_GoodsInfo_LogicDelete",
new AnnotationValues(oldValue: "EntityFramework.DynamicFilters.DynamicFilterDefinition", newValue: null)
},
});
AlterTableAnnotations(
"dbo.ExceptionLogs",
c => new
{
Id = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
Position = c.String(unicode: false),
Message = c.String(unicode: false),
Stack = c.String(unicode: false),
ExceptionLevel = c.Int(nullable: false),
OtherInfo = c.String(unicode: false),
RemoteIP = c.String(unicode: false),
ExceptionTime = c.DateTime(nullable: false, precision: 0),
SortCode = c.Int(nullable: false),
DeleteMark = c.Boolean(nullable: false),
CreateUserId = c.String(maxLength: 120, storeType: "nvarchar"),
ModifierId = c.String(maxLength: 120, storeType: "nvarchar"),
DeleteUserId = c.String(maxLength: 120, storeType: "nvarchar"),
CreateDate = c.DateTime(nullable: false, precision: 0),
ModifyDate = c.DateTime(nullable: false, precision: 0),
DeleteDate = c.DateTime(nullable: false, precision: 0),
Remark = c.String(unicode: false),
},
annotations: new Dictionary<string, AnnotationValues>
{
{
"DynamicFilter_ExceptionLog_LogicDelete",
new AnnotationValues(oldValue: "EntityFramework.DynamicFilters.DynamicFilterDefinition", newValue: null)
},
});
AlterTableAnnotations(
"dbo.Roles",
c => new
{
Id = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
Name = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
SortCode = c.Int(nullable: false),
DeleteMark = c.Boolean(nullable: false),
CreateUserId = c.String(maxLength: 120, storeType: "nvarchar"),
ModifierId = c.String(maxLength: 120, storeType: "nvarchar"),
DeleteUserId = c.String(maxLength: 120, storeType: "nvarchar"),
CreateDate = c.DateTime(nullable: false, precision: 0),
ModifyDate = c.DateTime(nullable: false, precision: 0),
DeleteDate = c.DateTime(nullable: false, precision: 0),
Remark = c.String(unicode: false),
},
annotations: new Dictionary<string, AnnotationValues>
{
{
"DynamicFilter_Role_LogicDelete",
new AnnotationValues(oldValue: "EntityFramework.DynamicFilters.DynamicFilterDefinition", newValue: null)
},
});
AlterTableAnnotations(
"dbo.Users",
c => new
{
Id = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
DepartmentId = c.String(maxLength: 120, storeType: "nvarchar"),
Account = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
Name = c.String(maxLength: 120, storeType: "nvarchar"),
Email = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
Tel = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
Sex = c.Int(nullable: false),
Position = c.String(maxLength: 120, storeType: "nvarchar"),
Age = c.Int(nullable: false),
Address = c.String(maxLength: 120, storeType: "nvarchar"),
RoleId = c.String(maxLength: 120, storeType: "nvarchar"),
PasswordExpired = c.Boolean(nullable: false),
SortCode = c.Int(nullable: false),
DeleteMark = c.Boolean(nullable: false),
CreateUserId = c.String(maxLength: 120, storeType: "nvarchar"),
ModifierId = c.String(maxLength: 120, storeType: "nvarchar"),
DeleteUserId = c.String(maxLength: 120, storeType: "nvarchar"),
CreateDate = c.DateTime(nullable: false, precision: 0),
ModifyDate = c.DateTime(nullable: false, precision: 0),
DeleteDate = c.DateTime(nullable: false, precision: 0),
Remark = c.String(unicode: false),
},
annotations: new Dictionary<string, AnnotationValues>
{
{
"DynamicFilter_User_LogicDelete",
new AnnotationValues(oldValue: "EntityFramework.DynamicFilters.DynamicFilterDefinition", newValue: null)
},
});
AlterTableAnnotations(
"dbo.Departments",
c => new
{
Id = c.String(nullable: false, maxLength: 120, storeType: "nvarchar"),
DepartmentName = c.String(unicode: false),
Address = c.String(unicode: false),
Contact = c.String(unicode: false),
ParentDepartmentId = c.String(maxLength: 120, storeType: "nvarchar"),
SortCode = c.Int(nullable: false),
DeleteMark = c.Boolean(nullable: false),
CreateUserId = c.String(maxLength: 120, storeType: "nvarchar"),
ModifierId = c.String(maxLength: 120, storeType: "nvarchar"),
DeleteUserId = c.String(maxLength: 120, storeType: "nvarchar"),
CreateDate = c.DateTime(nullable: false, precision: 0),
ModifyDate = c.DateTime(nullable: false, precision: 0),
DeleteDate = c.DateTime(nullable: false, precision: 0),
Remark = c.String(unicode: false),
},
annotations: new Dictionary<string, AnnotationValues>
{
{
"DynamicFilter_Department_LogicDelete",
new AnnotationValues(oldValue: "EntityFramework.DynamicFilters.DynamicFilterDefinition", newValue: null)
},
});
}
}
}
The Exception was thrown by this action,I think. Thanks
Hello @hoxcape ,
Just to make sure, this issue is resolved? As it's caused by the Up
method and not directly by the EntityFramework.DynamicFilters
?
I'm right or something must be done on our side?
Best Regards,
Jonathan
Hello @JonathanMagnan ,
This issure is caused when I add a filter to OnModelCreating
,and the AlterTableAnnotations
method call will be generated in Up
method. When I removed modelBuilder.Filter()
,EF will not invoke migration and the AlterTableAnnotations
neither.So I think migration script above might be generated by EntityFramework.DynamicFilters
.
Thanks.
Hello @hoxcape ,
Sorry for the delay, I forget to answer you.
Adding filter using this library may raise Migration
as their is some internal change that's made as if a new property is added.
There is currently to plan to change it as it may be currently to complex to make sure the migration is not fired.
Best Regards,
Jonathan