Component | Build | Status |
---|---|---|
ASP.NET Core OData | Rolling | |
ASP.NET Core OData | Nightly | |
.NET Foundation | Release |
Be noted: Switch to use "main" as default branch. 1/6/2022
This is the official ASP.NET Core OData repository. ASP.NET Core OData is a server side library built upon ODataLib and ASP.NET Core.
Blogs:
Example:
-
ODataRoutingSample: ASP.NET Core OData sample project in this repo.
-
~/$odata
gives a static routing table page of the service -
~/swagger
gives a swagger/openapi page -
Append
~/$openapi
to each route gives a raw openapi OData page, for example,~/v1/$openapi
Please go to sample folder see more samples.
-
Solution:
-
- Includes Microsoft.AspNetCore.OData project, Unit Test, E2E Test & Samples
-
AspNetCoreOData.NewtonsoftJson.sln
- Includes Microsoft.AspNetCore.OData.NewtonsoftJson project, Unit Test, E2E Test & Samples
In the ASP.NET Core Web Application project, update your Startup.cs
as below:
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddDbContext<BookStoreContext>(opt => opt.UseInMemoryDatabase("BookLists"));
services.AddControllers().AddOData(opt => opt.AddRouteComponents("odata", GetEdmModel()));
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
// Send "~/$odata" to debug routing if enable the following middleware
// app.UseODataRouteDebug();
app.UseRouting();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
}
private static IEdmModel GetEdmModel()
{
// …
}
}
That's it.
Visual Studio 2019 Preview is necessary to build the project.
Since the project introducts the .NET 6 targe framework to support DateOnly
and TimeOnly
, Visual Studio 2022 is required to build source project. (Edit at 2/10/2022)
Coming soon.
The symbol package is uploaded to nuget symbol server.
It supports source link debug. Remember to make Enable Source Link support
checked if you debug using Visual Studio.
The nightly build process will upload a NuGet packages for ASP.NET Core OData to:
To connect to webapinightly feed, use this feed URL:
-
https://www.myget.org/F/webapinetcore/api/v3/index.json (Your NuGet V3 feed URL (Visual Studio 2015+)
-
https://www.myget.org/F/webapinetcore/api/v2 Your NuGet V2 feed URL (Visual Studio 2012+)
-
ODataRoutingSample: ASP.NET Core OData sample project in this repo.
-
ASP.NET OData 8.0 Preview for .NET 5: A blog introducing the project.
-
Our docs folder: Our current documentation
Any contribution, feature request, bug, issue are welcome.
This project has adopted the .NET Foundation Contributor Covenant Code of Conduct. For more information see the Code of Conduct FAQ.
This project is supported by the .NET Foundation.
AspNetCoreOData is a Copyright of © .NET Foundation and other contributors. It is licensed under MIT License