Fluxtor 1.0.0
dotnet add package Fluxtor --version 1.0.0
NuGet\Install-Package Fluxtor -Version 1.0.0
<PackageReference Include="Fluxtor" Version="1.0.0" />
<PackageVersion Include="Fluxtor" Version="1.0.0" />
<PackageReference Include="Fluxtor" />
paket add Fluxtor --version 1.0.0
#r "nuget: Fluxtor, 1.0.0"
#:package Fluxtor@1.0.0
#addin nuget:?package=Fluxtor&version=1.0.0
#tool nuget:?package=Fluxtor&version=1.0.0
Fluxtor
Fluxtor is a library to manage generic entities, repositories, and services in .NET applications. It makes it easier to implement the Domain-Driven Design (DDD) pattern or simply to quickly create a POC without a lot of boilerplate code.
Table of Contents
Features
Fluxtor provides the following features:
- Generic entities management
- Generic repositories with full CRUD support
- Generic services to interact with entities and repositories
- A query builder to generate SQL queries
Requirements
- .NET 9.0 or later
- Dapper
- AutoMapper
- Microsoft.Extensions.Logging.Abstractions
Installation
Install the package via .NET CLI:
dotnet add package Fluxtor
Or via Package Manager UI in Visual Studio or your favorite IDE.
Usage
Entities
To get started, create a class that inherits from BaseObjectId<T> with the specific Id type you want to use and implement an Id generator.
public class UserId: BaseObjectId<int>
{
protected override int GenerateId()
{
return 1;
}
}
![Note] The Id generator is mandatory, but if you are using an auto-increment
Idyou can return any integer. It will be ignored during insertion unless you explicitly set it.
Next, create your entity inheriting from BaseEntity<T, TId>, where:
Tis the Id type you created beforeTIdis the class that inherits fromBaseObjectId
public class User: BaseEntity<int, UserId>
{
public override string TableName => "Users";
public string Name { get; set; }
public int Age { get; set; }
public DateTime CreatedAt { get; set; }
...
}
![Note] Always override the TableName property — it will be used to generate the queries.
Repositories
Before using repositories, create a connection class that inherits from DatabaseConnection and implement the CreateConnection method.
This design allows Dapper to work with any supported database.
public class SqliteConnection : DatabaseConnection
{
protected override IDbConnection CreateConnection()
{
return new SqliteConnection("Data Source=:memory:;");
}
}
The repository acts as a generic repository for your entities and provides all CRUD operations.
Your entities must inherit from BaseEntity<T, TId>.
If you need custom behavior, you can:
- Inherit from BaseRepository<TEntity, T, TId>, or
- Implement your own IRepository<TEntity, T, TId>.
![Note] The repository always returns a
RepositoryResponseobject. If an error occurs, it will setSuccess = falseand include the error message.
Services
Services map DTOs to entities and persist them via repositories. For validations or business logic, inherit from BaseService<TEntity, T, TId, TReadDto, TInsertDto, TUpdateDto> and override the necessary methods.
public class UserService : BaseService<User, int, UserId , UserReadDto, UserInsertDto, UserUpdateDto>
{
public override Task<RepositoryResponse<UserId>> CreateAsync(User user)
{
// Add your custom validations or business logic here
// Call the base implementation to execute the operation
return base.CreateAsync(user);
}
}
![Note] You only need to override methods that require customization.
Query Builder
The query builder helps generate SQL queries for your entities. It supports:
- Select
- Insert
- Update
- Delete
By default, all public properties of the entity are included. UPDATE and DELETE operations will use the Id as the default filter.
You can also specify fields and filters:
var fields = new List<string> { "Name", "Age" };
var filters = new List<string> { "Name" };
var queryBuilder = new QueryBuilder<User, UserId>();
var query = queryBuilder.GetQuery(QueryType.Select, fields, filters);
// This will return a query like:
// SELECT Name, Age FROM Users WHERE Name = @Name;
![Note] The query builder always returns a
string. It is extensible if you need to build more complex queries.
Configuration
Register the dependencies in your Startup.cs (or equivalent):
services.AddScoped<IDatabaseConnection, SqliteDatabaseConnection>();
services.AddScoped(typeof(IRepository<,,>), typeof(BaseRepository<,,>));
services.AddScoped(typeof(IService<,,,,,>), typeof(BaseService<,,,,,>));
services.AddScoped(typeof(IQueryProvider<,,>), typeof(QueryProvider<,,>)
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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. |
-
net9.0
- AutoMapper (>= 15.0.1)
- Dapper (>= 2.1.66)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.8)
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 |
|---|---|---|
| 1.0.0 | 214 | 9/1/2025 |