EFCore3.1中如何映射ValueObject

How mapping ValueObject in EFCore3.1

实体:

public class Good : FullAuditedAggregateRoot<Guid>
{
   ///******///
  public virtual SaleStates SaleStates { get; set; }
}

模型构建者:

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

好像是ABP的问题。 遇到这个问题时,唯一帮助我的是在值对象的 class 名称上方使用 [Owned] 属性。