I have created an OData v4 Client with the OData Client Generator. This generated partial classes. I would like to extend this generated classes with IDataErrorInfo.
namespace Client.Model {
public partial class City : IDataErrorInfo
{
public String this[String columnName]
{
return "";
}
public String Error { get { return ""; } }
}
}
When i like to create a new City and send it to the server
ODataContainer container = new ODataContainer(new Uri("http://localhost:45666/odata"));
container.AddToCities(city);
I get an error
An exception of type 'Microsoft.OData.Client.DataServiceRequestException' occurred in Microsoft.OData.Client.dll.
The request is invalid. The property "Error" does not exist in Server.Model.City.
The WebApi configuration:
public static class WebApiConfig
{
public static void Register(HttpConfiguration config)
{
config.MapHttpAttributeRoutes();
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
ODataModelBuilder builder = new ODataConventionModelBuilder();
builder.EntitySet<City>("Cities");
builder.EntitySet<Country>("Countries");
config.MapODataServiceRoute(
routeName: "ODataRoute",
routePrefix: "odata",
model: builder.GetEdmModel());
}
}
Is there a possibilty to prevent the Error property being included in the request?