DomainCraft 1.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package DomainCraft --version 1.0.1                
NuGet\Install-Package DomainCraft -Version 1.0.1                
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="DomainCraft" Version="1.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DomainCraft --version 1.0.1                
#r "nuget: DomainCraft, 1.0.1"                
#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.
// Install DomainCraft as a Cake Addin
#addin nuget:?package=DomainCraft&version=1.0.1

// Install DomainCraft as a Cake Tool
#tool nuget:?package=DomainCraft&version=1.0.1                

DomainCraft

DomainCraft is a modular and extensible framework designed to simplify the implementation of Clean Architecture and Domain-Driven Design (DDD) in .NET applications. It provides ready-to-use utilities like Generic Repositories, Caching, Logging, Event Bus, Dependency Injection Helpers, and more.

📦 Installation

To install DomainCraft, use NuGet Package Manager:

Install-Package DomainCraft

Or via .NET CLI:

dotnet add package DomainCraft

🚀 Features

1️⃣ EF Core Generic Repository & Unit of Work

Provides a generic repository pattern with built-in Unit of Work.

services.AddDomainCraftEFCore();

Includes:

  • Generic Repository (IRepository<T, TKey>)
  • Unit of Work (IUnitOfWork)
  • Query Support (IQueryable, AsNoTracking)

2️⃣ Caching with Redis

Provides distributed caching with Redis.

services.AddDomainCraftCaching(options =>
{
    options.RedisConnectionString = "localhost:6379";
    options.InstanceName = "MyAppCache";
});

Features:

  • Supports in-memory and Redis
  • Configurable expiration & eviction policies

3️⃣ Logging Middleware (Serilog + Elasticsearch)

Automatically logs API requests & responses and sends them to Elasticsearch.

services.AddDomainCraftLogging(configuration);

Features:

  • Correlation ID support for tracing requests
  • Structured logging using Serilog
  • Integration with Elasticsearch

4️⃣ Event Bus (MassTransit + RabbitMQ)

Implements Event-Driven Architecture with MassTransit and RabbitMQ.

services.AddDomainCraftEventBus(options =>
{
    options.Host = "rabbitmq://localhost";
    options.Username = "guest";
    options.Password = "guest";
});

Features:

  • Publish/Subscribe mechanism for microservices
  • Retry Policies and Circuit Breaker with Polly
  • Supports Multiple Consumers

📌 Publishing an Event:

await _eventBus.PublishAsync(new OrderCreatedEvent(orderId));

📌 Consuming an Event:

public class OrderCreatedConsumer : EventConsumer<OrderCreatedEvent>
{
    public override async Task ConsumeAsync(OrderCreatedEvent message)
    {
        Console.WriteLine($"Processing order: {message.OrderId}");
    }
}

🛠 Registering DomainCraft in Your Application

In Program.cs, register DomainCraft:

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddDomainCraft(builder.Configuration, options =>
{
    options.UseCaching = true;
    options.ConfigureCache = cacheOptions =>
    {
        cacheOptions.RedisConnectionString = "localhost:6379";
    };
});

var app = builder.Build();
app.UseDomainCraftMiddlewares();
app.Run();

🔥 Contributing

We welcome contributions! Feel free to open an Issue or Pull Request.

License

DomainCraft is open-source under the MIT License.

🚀 Happy Coding!

Product 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 was computed.  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. 
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.3 60 2/2/2025
1.0.2 54 2/1/2025
1.0.1 51 2/1/2025
1.0.0 51 2/1/2025