Thank you for your interest in contributing to DKNet! This document provides guidelines and information for contributors.
- Code of Conduct
- Getting Started
- Development Setup
- Building the Project
- Running Tests
- Coding Standards
- Pull Request Process
- Release Process
- Documentation Guidelines
This project adheres to the Microsoft Open Source Code of Conduct. By participating, you are expected to uphold this code.
- .NET 10.0 SDK or later
- Git
- Visual Studio 2022 (17.13+), Visual Studio Code, or JetBrains Rider (recommended)
- SQL Server or SQL Server LocalDB (for integration tests)
- Fork the repository on GitHub
- Clone your fork locally:
git clone https://github.com/YOUR_USERNAME/DKNet.git cd DKNet - Add the upstream remote:
git remote add upstream https://github.com/baoduy/DKNet.git
-
Install .NET 10.0 SDK:
# Use the provided script ./src/dotnet-install.sh --version 10.0.100 -
Restore NuGet packages:
cd src dotnet restore DKNet.FW.sln -
Verify setup:
dotnet build DKNet.FW.sln
- Install version 17.13 or later with .NET 10.0 support
- Recommended extensions:
- CodeMaid (code cleanup)
- SonarLint (code quality)
- Meziantou.Analyzer (already included in projects)
- Install the C# extension (with .NET 10 SDK support)
- Install the .NET Core Test Explorer extension
- Configure EditorConfig support
- Use the latest version with .NET 10.0 support
- Enable EditorConfig support
- Configure code style according to
.editorconfig
cd src
dotnet build DKNet.FW.sln --configuration Releasecd src/Core/DKNet.Fw.Extensions
dotnet build --configuration Release- Debug: Default development configuration with full debugging symbols
- Release: Optimized build for production use
cd src
dotnet test DKNet.FW.sln --configuration Releasecd src/Core/Fw.Extensions.Tests
dotnet test --configuration Release- Unit Tests: Fast, isolated tests for individual components
- Integration Tests: Tests that verify component interactions
- End-to-End Tests: Full application flow tests (in Templates)
- All public APIs must have corresponding unit tests
- Integration tests must use TestContainers or Aspire hosting when possible
- Use Shouldly for all assertions
- Tests must be deterministic and isolated
Follow the DKNet Coding Guidelines and Microsoft .NET guidelines:
- Use C# 14.0 language features appropriately
- Follow
.editorconfigrules - Write self-documenting code with meaningful names
- Add XML documentation for all public APIs
// ✅ Good
public class ProductService : IProductService
{
private readonly IProductRepository _productRepository;
private readonly ILogger<ProductService> _logger;
public ProductService(IProductRepository productRepository, ILogger<ProductService> logger)
{
_productRepository = productRepository;
_logger = logger;
}
/// <summary>
/// Creates a new product with the specified details.
/// </summary>
/// <param name="name">The product name.</param>
/// <param name="price">The product price.</param>
/// <param name="cancellationToken">Cancellation token.</param>
/// <returns>The created product.</returns>
public async Task<Product> CreateProductAsync(string name, decimal price, CancellationToken cancellationToken = default)
{
ArgumentException.ThrowIfNullOrEmpty(name);
ArgumentOutOfRangeException.ThrowIfNegativeOrZero(price);
var product = new Product(name, price);
await _productRepository.AddAsync(product, cancellationToken);
_logger.LogInformation("Created product {ProductId} with name {Name}", product.Id, name);
return product;
}
}- Classes/Interfaces: PascalCase (e.g.,
ProductService,IProductRepository) - Methods/Properties: PascalCase (e.g.,
CreateProduct,TotalAmount) - Fields:
_camelCasefor private fields (e.g.,_productRepository) - Parameters/Locals: camelCase (e.g.,
productName,totalAmount) - Constants: PascalCase (e.g.,
MaxRetryCount)
- Use centralized package version management in
Directory.Packages.props - Do not specify versions in individual
.csprojfiles - Prefer stable package versions over pre-release
- Document breaking changes in CHANGELOG.md
-
Ensure your fork is up-to-date:
git fetch upstream git checkout main git merge upstream/main
-
Create a feature branch:
git checkout -b feature/your-feature-name
-
Make your changes following coding standards
-
Add/update tests for your changes
-
Update documentation:
- Update README.md if adding new features
- Update CHANGELOG.md for your package
- Add XML documentation for public APIs
-
Build and test locally:
dotnet build DKNet.FW.sln --configuration Release dotnet test DKNet.FW.sln --configuration Release
- Description: Clear description of what the PR does and why
- Tests: All new code must have appropriate test coverage
- Documentation: Updated documentation for any API changes
- Changelog: Updated CHANGELOG.md for affected packages
- Breaking Changes: Clearly marked and documented if any
- Small Scope: Keep PRs focused and reasonably sized
## Description
Brief description of changes
## Type of Change
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Documentation update
## Testing
- [ ] Unit tests added/updated
- [ ] Integration tests added/updated
- [ ] Manual testing completed
## Documentation
- [ ] README.md updated
- [ ] CHANGELOG.md updated
- [ ] XML documentation added for public APIs
## Checklist
- [ ] Code follows project style guidelines
- [ ] Self-review completed
- [ ] Tests pass locally
- [ ] Documentation is up-to-dateDKNet follows Semantic Versioning:
- MAJOR: Breaking changes
- MINOR: New features (backward compatible)
- PATCH: Bug fixes (backward compatible)
-
Update Version Numbers:
- Update
Directory.Packages.propswith new versions - Update CHANGELOG.md files for affected packages
- Update
-
Create Release Branch:
git checkout -b release/v1.2.0
-
Final Testing:
dotnet build DKNet.FW.sln --configuration Release dotnet test DKNet.FW.sln --configuration Release -
Create Release:
- Create GitHub release with tag
- Include release notes from CHANGELOG.md
- Publish to NuGet (automated via GitHub Actions)
For critical bugs requiring immediate release:
-
Create Hotfix Branch from main:
git checkout -b hotfix/v1.1.1
-
Apply Minimal Fix
-
Test Thoroughly
-
Release Following Standard Process
Each package should have a README.md with:
- Title and Badges: Package name, NuGet badges, license
- Description: What the package does
- Features: Key capabilities
- Installation: NuGet installation instructions
- Quick Start: Basic usage examples
- Configuration: Setup and configuration options
- API Reference: Key classes and methods
- Advanced Usage: Complex scenarios
- Contributing: Link to this file
- License: License information
- XML Documentation: All public APIs must have XML docs
- Examples: Include code examples in documentation
- Thread Safety: Document thread safety characteristics
- Performance: Note any performance considerations
Follow Keep a Changelog format:
## [1.2.0] - 2024-01-15
### Added
- New feature description
### Changed
- Changed behavior description
### Deprecated
- Feature marked for removal
### Removed
- Removed feature description
### Fixed
- Bug fix description
### Security
- Security fix description- General Questions: Open a GitHub Discussion
- Bug Reports: Create a GitHub Issue with reproduction steps
- Feature Requests: Open a GitHub Issue with detailed requirements
- Security Issues: Email security@drunkcoding.net
Contributors will be recognized in:
- GitHub contributors list
- Release notes for significant contributions
- Special recognition for first-time contributors
Thank you for contributing to DKNet! 🚀