Cannot use 'Microsoft.AspNet.OData.Routing.ODataRoute' with Endpoint Routing.' Exception with ASP Net Core 2.2 : <p>After upgrading the ASP NET Web API project framework to the Core 2.2 version, the OData route configuration fails. It throws "Cannot use 'Microsoft.AspNet.OData.Routing.ODataRoute' with Endpoint Routing." Exception.</p>

<p>The link <a href="https://github.com/Microsoft/aspnet-api-versioning/issues/361" rel="noreferrer">https://github.com/Microsoft/aspnet-api-versioning/issues/361</a> shows how to avoid the exception but disabling the new Core 2.2 routing model. Can you tell me how to solve the problem without deactivating this functionality?</p>

<pre><code> public IServiceProvider ConfigureServices(IServiceCollection services)
 {
      ...

      services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2).AddControllersAsServices();

      ...
 }

 public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
 {

    ...

    app.UseMvc(b =&gt;
    {
        b.Select().Expand().Filter().OrderBy().MaxTop(100).Count();
        b.MapODataServiceRoute("odata", "odata", ODataConfig.GetEdmModel());
    });
}
</code></pre>
