我有这些模型,即CustomerID的ParentID外键 我想通过导航属性为客户插入地址 我该怎么办?
public partial class Customer
{
public long CustomerID { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public virtual ICollection<Address> Addresses { get; set; }
public virtual ICollection<Cart> Carts { get; set; }
public virtual ICollection<Order> Orders { get; set; }
}
public partial class Address
{
public long AddressID { get; set; }
public long ParentID { get; set; }
public string State { get; set; }
public string City { get; set; }
public string Address1 { get; set; }
public string PostalCode { get; set; }
public virtual Customer Customer { get; set; }
public virtual Supplier Supplier { get; set; }
}