我需要使用一对多关系播种我的数据(一个联系人可以有多个地址)但它不会让我播种我指定为 ICollection 的地址。我不能将它存储为字符串或整数。那我该怎么办?
namespace SuccessEd.Data.Model
{
public class Contact
{
public int ContactId { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public virtual ICollection<Address> Addresses { get; set; }
}
}
namespace SuccessEd.Data.Model
{
public class Address
{
public int AddressId { get; set; }
public string HomeAddress { get; set; }
public string BusinessAddress { get; set; }
public string PoBox { get; set; }
public int ContactId { get; set; }
public virtual Contact Contact { get; set; }
}