OdataToEntity.AspNetCore
2.2.0
See the version list below for details.
dotnet add package OdataToEntity.AspNetCore --version 2.2.0
NuGet\Install-Package OdataToEntity.AspNetCore -Version 2.2.0
<PackageReference Include="OdataToEntity.AspNetCore" Version="2.2.0" />
paket add OdataToEntity.AspNetCore --version 2.2.0
#r "nuget: OdataToEntity.AspNetCore, 2.2.0"
// Install OdataToEntity.AspNetCore as a Cake Addin #addin nuget:?package=OdataToEntity.AspNetCore&version=2.2.0 // Install OdataToEntity.AspNetCore as a Cake Tool #tool nuget:?package=OdataToEntity.AspNetCore&version=2.2.0
OdataToEntity
OData .net core
This library provides a simple approach to creating OData service from ORM data context. This translates the OData query into an expression tree and passes it to the ORM framework. Supported ORM: Entity Framework 6, Entity Framework Core, Linq2Db
public sealed class OrderContext : DbContext
{
public DbSet<Customer> Customers { get; set; }
public DbSet<Order> Orders { get; set; }
public IEnumerable<Order> GetOrders(int? id, String name, OrderStatus? status) => throw new NotImplementedException();
}
Build OData EdmModel
Buid from entity classes marked data annotation attribute, the general case for all providers
//Create adapter data access, where OrderContext your DbContext
var dataAdapter = new OeEfCoreDataAdapter<Model.OrderContext>();
//Build OData Edm Model
EdmModel edmModel = dataAdapter.BuildEdmModel();
Build from the Entity Framework Core where the data context uses the "Fluent API" (without using attributes)
//Create adapter data access, where OrderContext your DbContext
var dataAdapter = new OeEfCoreDataAdapter<Model.OrderContext>();
//Build OData Edm Model
EdmModel edmModel = dataAdapter.BuildEdmModelFromEfCoreModel();
Build from the Entity Framework 6 where the data context uses the "Fluent API" (without using attributes)
//Create adapter data access, where OrderEf6Context your DbContext
var dataAdapter = new OeEf6DataAdapter<OrderEf6Context>();
//Build OData Edm Model
EdmModel edmModel = dataAdapter.BuildEdmModelFromEf6Model();
Build from multiple data contexts
//Create referenced data adapter
var refDataAdapter = new OeEfCoreDataAdapter<Model.Order2Context>();
//Build referenced Edm Model
EdmModel refModel = refDataAdapter.BuildEdmModel();
//Create root data adapter
var rootDataAdapter = new OeEfCoreDataAdapter<Model.OrderContext>();
//Build root Edm Model
EdmModel rootModel = rootDataAdapter.BuildEdmModel(refModel);
Sample OData query
By default used cached queries parsed to expression tree, which on existing tests allows you to increase the performance up to three times. For disable this feature, you need pass in base constructor OeDataAdapter parameter new OeQueryCache(false). The query is parameterized (i.e. constant expressions are replaced with variables) except null value, therefore for best performance must use database null semantics. For Ef Core method UseRelationalNulls class RelationalDbContextOptionsBuilder<TBuilder, TExtension>, for Ef6 property UseDatabaseNullSemantics class DbContextConfiguration.
//Create adapter data access, where OrderContext your DbContext
var dataAdapter = new OeEfCoreDataAdapter<Model.OrderContext>();
//Create query parser
var parser = new OeParser(new Uri("http://dummy"), dataAdapter.BuildEdmModel());
//Query
var uri = new Uri("http://dummy/Orders?$select=Name");
//The result of the query
var response = new MemoryStream();
//Execute query
await parser.ExecuteGetAsync(uri, OeRequestHeaders.JsonDefault, response, CancellationToken.None);
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Microsoft.AspNetCore (>= 2.2.0)
- Microsoft.AspNetCore.Mvc.Abstractions (>= 2.2.0)
- Microsoft.AspNetCore.Mvc.Core (>= 2.2.0)
- Microsoft.OData.Core (>= 7.5.3)
- Microsoft.OData.Edm (>= 7.5.3)
- OdataToEntity (>= 2.2.0)
- System.Interactive.Async (>= 3.2.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
2.8.0 | 1,857 | 7/23/2021 |
2.7.0 | 389 | 3/7/2021 |
2.6.1 | 468 | 1/9/2021 |
2.6.0 | 407 | 11/13/2020 |
2.5.1 | 461 | 8/8/2020 |
2.5.0.3 | 1,669 | 5/26/2020 |
2.5.0.2 | 484 | 5/24/2020 |
2.5.0 | 640 | 2/26/2020 |
2.4.0 | 621 | 9/28/2019 |
2.3.1 | 627 | 6/4/2019 |
2.3.0 | 804 | 5/2/2019 |
2.2.0 | 686 | 2/3/2019 |
2.1.0 | 716 | 12/2/2018 |
2.0.1 | 720 | 10/31/2018 |
2.0.0 | 837 | 8/18/2018 |
2.0.0-beta1 | 670 | 8/15/2018 |
2.0.0-beta | 668 | 8/12/2018 |
1.6.3 | 950 | 7/18/2018 |
1.6.2 | 868 | 7/17/2018 |
1.6.0 | 894 | 7/15/2018 |
1.5.0 | 1,069 | 6/3/2018 |
1.4.1 | 1,054 | 4/1/2018 |
1.4.0 | 1,154 | 3/4/2018 |