OData一次将相关实体添加到两个表

时间:2015-06-16 19:49:06

标签: c# entity-framework-6 odata

我在C#中使用Odata服务。我有两个poco的联系方式和地址。地址是ContactID的可空FK。我需要让Odata添加联系人和地址。我尝试过AddLink和SetLink但得到Navigation Routing error。这是poco的课程:

Contact
[key]
public Guid ContactID {get;set;}
public string Name{get;set;}
public ICollection<Address> ContactAddresses{get;set;}

Address
[key]
public Guid AddressID{get;set;}
public string Address {get;set;}
[ForeignKey["Contact"]
public Guid? ContactID
[ForeignKey["Tenant"]{get;set;}
public Guid? TenantID {get;set;}
public Contact Contact{get;set;}
public Tenant Tenant{get;set;}

我在C#中使用OData服务。 OData模型是地址和联系人。

0 个答案:

没有答案
相关问题