EF错误:找不到适用于实体类型'ProductPlanProcessOrder'的合适的构造函数。以下构造函数的参数无法绑定到实体类型的属性:无法绑定“ ProductPlanProcessOrder(string id,int alloctNum,int finishNum)”中的“ alloctNum”,“ finishedNum”。
如果我不使用ignore方法,则不会发生此错误, 我不明白发生了什么事:
modelBuilder.Entity<ProductPlanProcessOrder>().Ignore(i =>
i.AlloctNum).Ignore(i=>i.FinishedNum);
public class ProductPlanProcessOrder
{
public string Id { get; private set; }
public int AlloctNum { get; private set; }
public int FinishedNum{ get; private set; }
private ProductPlanProcessOrder(string id , int alloctNum = 0, int finishedNum = 0
)
{
this.Id = id;
AlloctNum = alloctNum;
FinishedNum = finishedNum;
}
}