0
我有我的實體元素與導航屬性成分:使用Web API將導航屬性值傳遞給URI的方式是什麼?
public class Element
{
public int Id { get; set; }
public string Name { get; set; }
public virtual ICollection<Ingredient> Ingredients { get; set; }
public string Description { get; set; }
}
public class Ingredient
{
public int Id { get; set; }
public string Name { get; set; }
}
API控制器定義:
[HttpGet("elements", Name = "GetElement")]
public Element GetElement ([FromUri] Element element)
{
//<..>
}
你如何格式化的URI傳入的成分參數?