title: How to use OData in ASP.NET Core 2.1?
body: <p>I try to use OData in an ASP. Bellow my code:</p>
  
  <pre><code>//============== Startup.cs
  public void ConfigureServices(IServiceCollection services) {
      services.AddDbContext&lt;EntriesContext&gt;(
          opt =&gt; opt.UseMySql("server=localhost;database=mydb;user=myusr;password=mypass",
          mysqlOptions =&gt;{mysqlOptions.ServerVersion(new Version(5..), ServerType.MySql);}));
  
      services.AddOData();
      services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
      ...
      }
  
      public void Configure(IApplicationBuilder app, IHostingEnvironment env) {
          ...
          app.UseMvc(b =&gt; { b.MapODataServiceRoute("odata", "odata", GetEdmModel()); });
      }
  
      private static IEdmModel GetEdmModel() {
          ODataConventionModelBuilder builder = new ODataConventionModelBuilder();
          builder.EntitySet&lt;Entry&gt;("Entries");
          return builder.GetEdmModel();
      }
  </code></pre>
  
  <p>The Controller: </p>
  
  <pre><code>[Route("api/[controller]")]
  [ApiController]
  [EnableCors("AllowMyOrigin")]
  public class EntriesController : ODataController
  {
      private readonly EntriesContext _context;
  
      public EntriesController(EntriesContext context) {
          _context = context;
      }
  
      [HttpGet]
      [EnableQuery]
      public ActionResult&lt;List&lt;Entry&gt;&gt; GetAll() {
          return _context.Entries.ToList();
      }
  </code></pre>
  
  <p>And the context: </p>
  
  <pre><code>public class EntriesContext : DbContext
  {
      public EntriesContext(DbContextOptions&lt;EntriesContext&gt; options) : base(options) { }
      public DbSet&lt;Entry&gt; Entries { get; set; }
  }
  </code></pre>
  
  <p>however, is not clear for me, what path should I use to get the entries (without OData I would use <code>localhost:9000/api/entries</code>, but now I am confused).</p>
  
  <p>I tried to do <code>https://localhost:44384/odata/entries</code> and <code>https://localhost:44384/odata/api/entries</code> but I get 404</p>
  
  <p>I tried to comment the controller's route, like this</p>
  
  <pre><code>//[Route("api/[controller]")]
  //[ApiController]
  [EnableCors("AllowMyOrigin")]
  public class EntriesController : ODataController 
  </code></pre>
  
  <p>and also modified the action</p>
  
  <pre><code>[HttpGet]
  [EnableQuery]
  public IActionResult Get() {
      return Ok(_db.Entries);
  }
  </code></pre>
  
  <p>I tried then <code>https://localhost:44384/odata/Entries</code> and gotthe full list of the entries... However, the <code>https://localhost:44384/odata/Entries?$take=2</code> does not work: 400 Bad Request: <code>Parameter name: $take' is not supported."</code></p>