NetDevPack

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

Github星跟踪图



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.

主要指标

概览
名称与所有者NetDevPack/NetDevPack
主编程语言C#
编程语言C# (语言数: 1)
平台
许可证MIT License
所有者活动
创建于2020-06-02 04:34:18
推送于2025-04-08 05:53:28
最后一次提交2025-04-08 02:53:27
发布数17
最新版本名称v6.1.1 (发布于 )
第一版名称v1.0.3 (发布于 )
用户参与
星数813
关注者数35
派生数99
提交数167
已启用问题?
问题数13
打开的问题数0
拉请求数31
打开的拉请求数0
关闭的拉请求数8
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?