【发布时间】:2017-01-20 03:41:37
【问题描述】:
我使用带有 EF6 的 Odata Webapi,我的模型如下
public class Company
{
Public Company()
{
Products = new List<Product>();
}
[Key]
public int Id { get; set; }
[Required]
public string Name { get; set; }
public List<Product> Products { get; set; }
}
public class Product
{
[Key]
public int Id { get; set; }
[Required]
public string Name { get; set; }
}
我需要公开一个端点以将产品添加到现有公司。 终点必须如下所示。
Post: ~odata/Company(1)/Products with body as List of products json.
body:[{"Name":"Product1"},{"Name":"Product2"}]
【问题讨论】:
标签: post asp.net-web-api entity-framework-6 odata