首先owned entity type是EF Core 2.0的新特性。
至于什么是owned entity types,可以先把他理解为EF Core官方支持的值对象。
值对象举一个简单的例子,你可能在开发中经常遇到,订单,地址,地址簿的关系:
public class Order { public int Id { get; set; } public string Name { get; set; } public double Price { get; set; } public Address Address { get; set; } } public class AddressBook { public string FriendName { get; set; } public int Id { get; set; } public Address Address { get; set; } } public class Address { public string City { get; set; } public string Street { get; set; } }