Something like this should work:
public class ODataModelBinderAttribute : ModelBinderAttribute
{
public override System.Web.Http.Controllers.HttpParameterBinding GetBinding(System.Web.Http.Controllers.HttpParameterDescriptor parameter)
{
ODataModelBinderProvider provider = new ODataModelBinderProvider();
return new ModelBinderParameterBinding(
parameter,
provider.GetBinder(parameter.Configuration, parameter.ParameterType),
this.GetValueProviderFactories(parameter.Configuration));
}
}
And in action, use it like:
public virtual HttpResponseMessage GetById([ODataModelBinder]TKey key)
We should update EntitySetController to use that attribute.
public class ODataModelBinderAttribute : ModelBinderAttribute
{
public override System.Web.Http.Controllers.HttpParameterBinding GetBinding(System.Web.Http.Controllers.HttpParameterDescriptor parameter)
{
ODataModelBinderProvider provider = new ODataModelBinderProvider();
return new ModelBinderParameterBinding(
parameter,
provider.GetBinder(parameter.Configuration, parameter.ParameterType),
this.GetValueProviderFactories(parameter.Configuration));
}
}
And in action, use it like:
public virtual HttpResponseMessage GetById([ODataModelBinder]TKey key)
We should update EntitySetController to use that attribute.