如何为具有KeyValuePair返回类型的OData服务构建EDM模型

时间:2017-01-16 05:12:08

标签: odata

发布方法:

[HttpPost]
public Dictionary<string, object> PostData(ODataActionParameters param)
{     
}

构建EDM模型:

 ODataConventionModelBuilder builder = new ODataConventionModelBuilder();
 var customSave = builder.EntityType<Model>().Collection.Action("PostData");

如何设置动作“customSave”的返回?

1 个答案:

答案 0 :(得分:0)

 ODataConventionModelBuilder builder = new ODataConventionModelBuilder();
 var customSave = builder.EntityType<Model>().Collection.Action("PostData");
 customSave.ReturnsCollection<Dictionary<string, object>>();

建立返回类型是Primitive或ComplexTypes集合时使用的Action的返回类型。