FlowX.EntityFrameworkCore
7.0.0
See the version list below for details.
dotnet add package FlowX.EntityFrameworkCore --version 7.0.0
NuGet\Install-Package FlowX.EntityFrameworkCore -Version 7.0.0
<PackageReference Include="FlowX.EntityFrameworkCore" Version="7.0.0" />
<PackageVersion Include="FlowX.EntityFrameworkCore" Version="7.0.0" />
<PackageReference Include="FlowX.EntityFrameworkCore" />
paket add FlowX.EntityFrameworkCore --version 7.0.0
#r "nuget: FlowX.EntityFrameworkCore, 7.0.0"
#:package FlowX.EntityFrameworkCore@7.0.0
#addin nuget:?package=FlowX.EntityFrameworkCore&version=7.0.0
#tool nuget:?package=FlowX.EntityFrameworkCore&version=7.0.0
FlowX.EntityFrameworkCore
FlowX.EntityFrameworkCore is an extension package for the FlowX library, providing seamless integration with Entity Framework Core.
Features
- Simplified integration with EF Core repositories.
- Built-in support for the Unit of Work pattern.
- Customizable database interaction flows for greater flexibility.
- Enhanced error handling for EF Core operations, ensuring reliability.
- Intuitive fluent API for managing EF Core entities with ease.
- Dynamic repository generation based on your models. Simply implement the IEfModel interface, and the rest is handled automatically!
- Comprehensive support for CRUD operations, including methods like CreateOne, CreateMany, GetOne, GetCollection, GetPaged, and GetCount.
- Build custom request flows by inheriting classes such as EfQueryOneHandler, EfQueryCollectionHandler, and EfCommandVoidHandler...
- Effortless debugging and maintenance: With everything organized as a flow, you can easily trace issues, maintain your codebase, and scale up with confidence.
Getting Started
Prerequisites
Ensure you have the following installed:
- .NET 8.0 or higher
- Microsoft.EntityFrameworkCore
- FlowX
Installation
To install the FlowX.EntityFrameworkCore package, use the following NuGet command:
dotnet add package FlowX.EntityFrameworkCore
Or via the NuGet Package Manager:
Install-Package FlowX.EntityFrameworkCore
Usage
Usage
Below is an example of how to use FlowX.EntityFrameworkCore to handle a CreateSomeThingCommand:
builder.Services.AddFlowX(cfg =>
{
cfg.AddModelsFromNamespaceContaining<ITestAssemblyMarker>();
cfg.AddHandlersFromNamespaceContaining<ITestAssemblyMarker>();
cfg.AddDbContextDynamic<TestDbContext>(options =>
{
options.AddDynamicRepositories();
options.AddDynamicUnitOfWork();
});
});
Examples:
public sealed class CreateSomeThingHandler(
ISqlRepository<SomeThing> sqlRepository,
IMapper mapper,
IUnitOfWork unitOfWork)
: EfCommandOneVoidHandler<SomeThing, CreateSomeThingCommand>(sqlRepository, unitOfWork)
{
protected override ICommandOneFlowBuilderVoid<SomeThing> BuildCommand(
IStartOneCommandVoid<SomeThing> fromFlow, CreateSomeThingCommand command,
CancellationToken cancellationToken)
=> fromFlow
.CreateOne(mapper.Map<SomeThing>(command))
.WithCondition(_ => None.Value)
.WithErrorIfSaveChange(SomeErrorDetail());
}
public class UpdateSomeThingHandler(
ISqlRepository<SomeThing> sqlRepository,
IUnitOfWork unitOfWork,
IMapper mapper)
: EfCommandOneVoidHandler<SomeThing, UpdateSomeThingCommand>(sqlRepository)
{
protected override ICommandOneFlowBuilderVoid<SomeThing> BuildCommand(
IStartOneCommandVoid<SomeThing> fromFlow, UpdateSomeThingCommand command,
CancellationToken cancellationToken)
=> fromFlow
.UpdateOne(x => x.Id == command.Id)
.WithSpecialAction(null)
.WithCondition(_ => None.Value)
.WithModify(someModel => Mapper.Map(command, someModel))
.WithErrorIfNull(MasterDataErrorDetail.SomeThingError.NotFound())
.WithErrorIfSaveChange(SomeErrorDetail());
}
public sealed class GetSomeThingHandler(ISqlRepository<SomeThing> sqlRepository, IMapper mapper)
: EfQueryOneHandler<SomeThing, GetSomeThingQuery, SomeThingResponse>(sqlRepository)
{
protected override IQueryOneFlowBuilder<SomeThing, SomeThingResponse> BuildQueryFlow(
IQueryOneFilter<SomeThing, SomeThingResponse> fromFlow, GetSomeThingQuery query)
=> fromFlow
.WithFilter(x => x.Id == query.Id)
.WithSpecialAction(x => x.ProjectTo<SomeThingResponse>(Mapper.ConfigurationProvider))
.WithErrorIfNull(SomeErrorDetail());
}
// ... Other Flows
Key Concepts
EF Core Repositories
FlowX.EntityFrameworkCore provides repository abstractions that simplify CRUD operations with EF Core. You can
inject ISqlRepository<T> to access database entities directly.
Unit of Work
Unit of Work ensures that all database operations within a command are executed in a single transaction, providing consistency and reliability.
Error Handling
This extension includes advanced error handling tailored for EF Core, enabling you to catch and manage database-related errors gracefully.
Contributing
We welcome contributions to FlowX.EntityFrameworkCore! To contribute, please:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Submit a pull request with a detailed explanation of your changes.
License
FlowX.EntityFrameworkCore is licensed under the MIT License. See LICENSE for more details.
Contact
For inquiries, reach out to [your email or GitHub link].
Enjoy your moment!
| Package Name | Description | .NET Version | Document |
|---|---|---|---|
| FlowX | FlowX core | 8.0, 9.0 | ReadMe |
| Data Provider | |||
| FlowX.EntityFrameworkCore | This is the FlowX extension package using EntityFramework to fetch data | 8.0, 9.0 | This Document |
| Transports | |||
| FlowX.Nats | FlowX.Nats is an extension package for FlowX that leverages Nats for efficient data transportation. | 8.0, 9.0 | ReadMe |
| FlowX.Azure.ServiceBus | FlowX.Azure.ServiceBus is an extension package for FlowX that leverages Azure ServiceBus for efficient data transportation. | 8.0, 9.0 | ReadMe |
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. 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. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- FlowX (>= 7.0.0)
- Microsoft.EntityFrameworkCore (>= 8.0.0)
-
net9.0
- FlowX (>= 7.0.0)
- Microsoft.EntityFrameworkCore (>= 8.0.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 |
|---|---|---|
| 7.0.5 | 75 | 1/8/2026 |
| 7.0.4 | 279 | 12/23/2025 |
| 7.0.3 | 223 | 12/14/2025 |
| 7.0.2 | 146 | 12/14/2025 |
| 7.0.1 | 423 | 12/11/2025 |
| 7.0.0 | 295 | 11/11/2025 |
| 6.0.7 | 205 | 10/30/2025 |
| 6.0.6 | 197 | 10/29/2025 |
| 6.0.5 | 180 | 10/22/2025 |
| 6.0.4 | 177 | 10/21/2025 |
| 6.0.3 | 190 | 10/20/2025 |
| 6.0.2 | 163 | 10/17/2025 |
| 6.0.1 | 170 | 10/17/2025 |
| 6.0.0 | 169 | 10/17/2025 |
| 5.0.1 | 312 | 4/26/2025 |
| 5.0.0 | 228 | 4/25/2025 |
| 4.0.2 | 217 | 4/24/2025 |
| 4.0.1 | 261 | 4/24/2025 |
| 4.0.0 | 511 | 3/19/2025 |
| 3.0.1 | 202 | 3/18/2025 |
| 3.0.0 | 168 | 2/13/2025 |
| 2.0.1 | 160 | 2/12/2025 |
| 2.0.0 | 149 | 2/11/2025 |
| 1.1.0 | 177 | 1/3/2025 |
| 1.0.0 | 166 | 1/2/2025 |