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 (發布於 )
用户参与
星數816
關注者數35
派生數100
提交數167
已啟用問題?
問題數13
打開的問題數0
拉請求數31
打開的拉請求數0
關閉的拉請求數8
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?