Skip to content

Instantly share code, notes, and snippets.

@Msirkovsky
Last active December 28, 2016 08:51
Show Gist options
  • Save Msirkovsky/7eaf0c637942cfc1468a5fabc6bb4928 to your computer and use it in GitHub Desktop.
Save Msirkovsky/7eaf0c637942cfc1468a5fabc6bb4928 to your computer and use it in GitHub Desktop.
public static class WebApiConfig
{
public static void Register(HttpConfiguration config)
{
config.Routes.MapHttpRoute(
  name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
  defaults: new { id = RouteParameter.Optional }
  );
config.EnableQuerySupport();
var modelBuilder = new ODataConventionModelBuilder();
  modelBuilder.EntitySet<DataSalesForExcel>("DataSalesForExcel");
var model = modelBuilder.GetEdmModel();
  config.Routes.MapODataRoute("ODataRoute", "odata", model);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment