实体:
public class Good : FullAuditedAggregateRoot<Guid>
{
///******///
public virtual SaleStates SaleStates { get; set; }
}ModelBuilder:
builder.Entity<Good>(b =>
{
///******///
b.OwnsOne(f=>f.SaleStates).WithOwner();
}错误:
System.InvalidOperationException : The type 'SaleStates' cannot be marked as owned because a non-owned entity type with the same name already exists.https://docs.microsoft.com/en-us/ef/core/what-is-new/ef-core-3.0/breaking-changes#config
发布于 2020-07-19 20:56:47
这似乎是总部基地的一个问题。遇到这个问题时,唯一对我有帮助的就是在值对象的类名上使用[Owned]属性。
https://stackoverflow.com/questions/60753365
复制相似问题