我有几个实体,例如Customer
,Vendors
,Employee
,我有另一个实体来处理Transaction Head
,请在此处查看定义:
public class TransactionHead
{
public string DocumentNo { get; set; }
public DocumentType TransactionType { get; set; }
public Location From { get; set; }
public object To { get; set; }//customer, supplier, location, employee "will have a discount table "
public DateTime DocumentDate { get; set; }
public float GrossAmount { get; set; }
public float TotalDiscount { get; set; }
public float NetAmount { get; set; }
public int DetailRowCount { get; set; }
public bool IsActive { get; set; }
public bool IsDeleted { get; set; }
public User Created { get; set; }
public User Updated { get; set; }
public User Approved { get; set; }
public DocumentStatus DocumentStatus { get; set; }
public string ApprovalRemark { get; set; }
public string DocumentRemark { get; set; }
public DateTime CreatedTimeStamp { get; set; }
public DateTime UpdatedTimeStamp { get; set; }
}
现在,当我创建迁移时,它会自动忽略To
实体的TransactionHead
属性。那么解决方案是什么?
谢谢
答案 0 :(得分:0)
没有。 EF不支持此功能,因为它在数据库中需要dynamic
列类型。 EF将始终忽略的object
属性。您可以在this链接中找到有关EF中复杂类型的更多信息。