NetDevPack

一套智能的通用类和实现方法,可提高您的开发效率。「A smart set of common classes and implementations to improve your development productivity.」

Github stars Tracking Chart



Package Version Popularity
NetDevPack NuGet Nuget

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:

dotnet add package NetDevPack

Basic Usage

Domain Entity

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

using NetDevPack.Data;

public interface ICustomerRepository : IRepository<Customer>
{
    Task<Customer> GetByName(string name);
}

Using the Mediator

public class CustomerCommandHandler : IRequestHandler<RegisterCustomerCommand, ValidationResult>
{
    private readonly IMediatorHandler _mediator;
    
    public CustomerCommandHandler(IMediatorHandler mediator)
    {
        _mediator = mediator;
    }

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

Fluent Validation

using FluentValidation;

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

Example

For a full implementation example, check Equinox Project

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 under the MIT license.

Main metrics

Overview
Name With OwnerNetDevPack/NetDevPack
Primary LanguageC#
Program languageC# (Language Count: 1)
Platform
License:MIT License
所有者活动
Created At2020-06-02 04:34:18
Pushed At2025-04-08 05:53:28
Last Commit At2025-04-08 02:53:27
Release Count17
Last Release Namev6.1.1 (Posted on )
First Release Namev1.0.3 (Posted on )
用户参与
Stargazers Count808
Watchers Count35
Fork Count99
Commits Count167
Has Issues Enabled
Issues Count13
Issue Open Count0
Pull Requests Count31
Pull Requests Open Count0
Pull Requests Close Count8
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private