OfX-EFCore is an extension package for OfX that integrates with Entity Framework Core to simplify data fetching by leveraging attribute-based data mapping. This extension streamlines data retrieval using EF Core, reducing boilerplate code and improving maintainability.
OfX-EFCore extends the core OfX library by providing seamless integration with Entity Framework Core. This enables developers to automatically map and retrieve data directly from a database, leveraging the power of Entity Framework Core along with attribute-based data mapping.
For example, suppose you have a UserId
property in your model, and you want to fetch the corresponding Name
and Email
fields from the database. By using OfX-EFCore, you can annotate your model with attributes, and the library
will handle data fetching for you.
To install the OfX-EFCore package, use the following NuGet command:
dotnet add package OfX-EFCore
Or via the NuGet Package Manager:
Install-Package OfX-EFCore
Add OfX-EfCore to your service configuration during application startup:
builder.Services.AddOfXEntityFrameworkCore(cfg =>
{
cfg.AddAttributesContainNamespaces(typeof(WhereTheAttributeDefined).Assembly);
cfg.AddHandlersFromNamespaceContaining<SomeHandlerAssemblyMarker>();
})
.AddOfXEFCore(options =>
{
options.AddDbContexts(typeof(TestDbContext), typeof(OtherDbContext)...);
});
Here, you can use the method AddDbContexts()
, which takes DbContext(s)
to executing.
That all, Enjoy your moment!
Package Name | Description | .NET Version | Document |
---|---|---|---|
Core | |||
OfX | OfX core | 8.0, 9.0 | ReadMe |
Data Providers | |||
OfX-EFCore | This is the OfX extension package using EntityFramework to fetch data | 8.0, 9.0 | This Document |
OfX-MongoDb | This is the OfX extension package using MongoDb to fetch data | 8.0, 9.0 | ReadMe |
Integrations | |||
OfX-HotChocolate | OfX.HotChocolate is an integration package with HotChocolate for OfX. | 8.0, 9.0 | ReadMe |
Transports | |||
OfX-gRPC | OfX.gRPC is an extension package for OfX that leverages gRPC for efficient data transportation. | 8.0, 9.0 | ReadMe |
OfX-Kafka | OfX-Kafka is an extension package for OfX that leverages Kafka for efficient data transportation. | 8.0, 9.0 | ReadMe |
OfX-Nats | OfX-Nats is an extension package for OfX that leverages Nats for efficient data transportation. | 8.0, 9.0 | ReadMe |
OfX-RabbitMq | OfX-RabbitMq is an extension package for OfX that leverages RabbitMq for efficient data transportation. | 8.0, 9.0 | ReadMe |