我有一个使用OData的Web API2应用程序,需要将模型属性以小写驼峰形式公开,在序列化时能够展现。
有一个EnableLowerCamelCase方法可以实现这一点,但是我无法让编译器识别它。甚至在CodePlex上有一个使用OData 6.5.0 展示EnableLowerCamelCase的示例。
ODataModelBuilder builder = new ODataConventionModelBuilder();
builder.EnableLowerCamelCase(); // <-- this won't compile
EnableLowerCamelCase已被移除了吗?我错过了什么吗?
我正在使用以下软件包版本:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Antlr" version="3.5.0.2" targetFramework="net45" />
<package id="elmah" version="1.2.2" targetFramework="net45" />
<package id="elmah.corelibrary" version="1.2.2" targetFramework="net45" />
<package id="Microsoft.AspNet.Mvc" version="5.2.0" targetFramework="net45" />
<package id="Microsoft.AspNet.OData" version="5.3.0" targetFramework="net45" />
<package id="Microsoft.AspNet.Razor" version="3.2.0" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi" version="5.2.2" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.2" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.2" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.2" targetFramework="net45" />
<package id="Microsoft.AspNet.WebPages" version="3.2.0" targetFramework="net45" />
<package id="Microsoft.OData.Core" version="6.8.0" targetFramework="net45" />
<package id="Microsoft.OData.Edm" version="6.8.0" targetFramework="net45" />
<package id="Microsoft.Spatial" version="6.8.0" targetFramework="net45" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" />
<package id="Newtonsoft.Json" version="6.0.5" targetFramework="net45" />
</packages>