An open API service indexing awesome lists of open source software.

https://github.com/NetDevPack/NetDevPack

A smart set of common classes and implementations to improve your development productivity.
https://github.com/NetDevPack/NetDevPack

aspnetcore cqrs ddd devpack fluentvalidation identity mediatr messaging notification specification-pattern validation

Last synced: 13 days ago
JSON representation

A smart set of common classes and implementations to improve your development productivity.

Awesome Lists containing this project

README

          

.NET DevPack

| Package | Version | Popularity |
| ------- | ----- | ----- |
| `NetDevPack` | [![NuGet](https://img.shields.io/nuget/v/NetDevPack.svg)](https://nuget.org/packages/NetDevPack) | [![Nuget](https://img.shields.io/nuget/dt/NetDevPack.svg)](https://nuget.org/packages/NetDevPack) |

## What is the .NET DevPack?

NetDevPack is a comprehensive set of reusable classes and interfaces designed to improve development experience and productivity in .NET applications. It encapsulates best practices and common patterns such as Domain-Driven Design (DDD), CQRS, Validation, Notification, and Mediator.

## Give a Star! ⭐

If you find this project useful, please give it a star! It helps us grow and improve the community.

## Features

- ✅ Domain-driven design base classes and interfaces
- ✅ CQRS support via Mediator pattern
- ✅ FluentValidation integration
- ✅ Domain events and notifications handling
- ✅ Unit of Work and repository base contracts

## Installation

Install via NuGet:

```bash
dotnet add package NetDevPack
```

## Basic Usage

### Domain Entity

```csharp
using NetDevPack.Domain;

public class Customer : Entity
{
public string Name { get; private set; }

public Customer(Guid id, string name)
{
Id = id;
Name = name;
}
}
```

### Repository Interface

```csharp
using NetDevPack.Data;

public interface ICustomerRepository : IRepository
{
Task GetByName(string name);
}
```

### Using the Mediator

```csharp
public class CustomerCommandHandler : IRequestHandler
{
private readonly IMediatorHandler _mediator;

public CustomerCommandHandler(IMediatorHandler mediator)
{
_mediator = mediator;
}

public async Task Handle(RegisterCustomerCommand request, CancellationToken cancellationToken)
{
// Business logic
await _mediator.PublishEvent(new CustomerRegisteredEvent(...));
return new ValidationResult();
}
}
```

### Fluent Validation

```csharp
using FluentValidation;

public class CustomerValidator : AbstractValidator
{
public CustomerValidator()
{
RuleFor(c => c.Name).NotEmpty();
}
}
```

## Example

For a full implementation example, check [Equinox Project](https://github.com/EduardoPires/EquinoxProject/)

## Compatibility

Supports:
- ✅ .NET Standard 2.1
- ✅ .NET 5 through 9 (including latest versions)
- ⚠️ Legacy support for .NET Core 3.1 and older (with limitations)

## About
.NET DevPack was developed by [Eduardo Pires](http://eduardopires.net.br) under the [MIT license](LICENSE).