Fluxtor 1.0.0

dotnet add package Fluxtor --version 1.0.0
                    
NuGet\Install-Package Fluxtor -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Fluxtor" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Fluxtor" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Fluxtor" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Fluxtor --version 1.0.0
                    
#r "nuget: Fluxtor, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Fluxtor@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Fluxtor&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Fluxtor&version=1.0.0
                    
Install as a Cake Tool

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 Id you 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:

  • T is the Id type you created before
  • TId is the class that inherits from BaseObjectId
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 RepositoryResponse object. If an error occurs, it will set Success = false and 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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