相关疑难解决方法(0)

实体框架核心:无法使用嵌套值对象更新实体

我有一个具有值对象的实体,该值对象具有另一个值对象.我的问题是,在更新实体和值对象时,具有父值对象的实体会更新,但子值对象不会更新.请注意,我使用的是最新版本的Entity Framework Core 2.1.0-rc1-final,这是父实体Employee

public class Employee : Entity
{
    public string FirstName { get; private set; }
    public string LastName { get; private set; }
    public string Email { get; private set; }
    public Address Address { get; private set; }
}
Run Code Online (Sandbox Code Playgroud)

这是父值对象Address

public class Address : ValueObject<Address>
{
    private Address() { }

    public Address(string street, string city, string state, string country, string zipcode, GeoLocation geoLocation)
    {
        Street = street;
        City = city;
        State = state;
        Country = country; …
Run Code Online (Sandbox Code Playgroud)

c# value-objects entity-framework-core entity-framework-core-2.1

5
推荐指数
1
解决办法
4001
查看次数