DKNet

Getting Started with DKNet Framework

Welcome to DKNet Framework! This guide will help you get started with the comprehensive .NET framework designed to enhance enterprise application development using Domain-Driven Design (DDD) principles.

πŸ“‹ Prerequisites

πŸš€ Quick Start

1. Installation

Choose the packages you need based on your requirements:

# Core Framework Extensions
dotnet add package DKNet.Fw.Extensions

# Entity Framework Core Extensions (full suite)
dotnet add package DKNet.EfCore.Extensions
dotnet add package DKNet.EfCore.Repos
dotnet add package DKNet.EfCore.Hooks

# Messaging & CQRS
dotnet add package DKNet.SlimBus.Extensions

# Blob Storage Services
dotnet add package DKNet.Svc.BlobStorage.Abstractions
# Choose your storage provider:
dotnet add package DKNet.Svc.BlobStorage.AzureStorage
# OR
dotnet add package DKNet.Svc.BlobStorage.AwsS3
# OR
dotnet add package DKNet.Svc.BlobStorage.Local

For a complete reference implementation, use the SlimBus API template:

# Clone the template
git clone https://github.com/baoduy/DKNet.git
cd DKNet/src/Templates/SlimBus.ApiEndpoints

# Restore and run
dotnet restore
dotnet run --project SlimBus.Api

3. Basic Setup

Here’s a minimal setup for a new project using DKNet:

using DKNet.Fw.Extensions;
using DKNet.EfCore.Extensions;
using Microsoft.EntityFrameworkCore;

var builder = WebApplication.CreateBuilder(args);

// Add DKNet services
builder.Services.AddDbContext<AppDbContext>(options =>
    options.UseSqlServer(builder.Configuration.GetConnectionString("Default")));

builder.Services.AddDKNetRepositories<AppDbContext>();

var app = builder.Build();

// Configure pipeline
app.UseRouting();
app.MapControllers();

app.Run();

πŸ—οΈ Architecture Overview

DKNet follows the Onion Architecture pattern with clear separation of concerns:

🌐 Presentation Layer (API Controllers, UI)
    ↓
🎯 Application Layer (Services, CQRS Handlers)
    ↓
πŸ’Ό Domain Layer (Entities, Business Logic)
    ↓
πŸ—„οΈ Infrastructure Layer (Data Access, External Services)

πŸ“š Next Steps

  1. Choose Your Components - Review available packages
  2. Architecture Guide - Understand DDD/Onion patterns
  3. Configuration - Setup and configuration options
  4. Examples - Practical implementation examples
  5. API Reference - Detailed API documentation

🎯 Common Use Cases

Building a CRUD API with CQRS

Perfect for implementing clean architecture with command/query separation.

Domain Event Handling

Implement event-driven architecture with built-in domain events.

Data Authorization

Row-level security and data filtering based on user context.

Multi-tenancy Support

Built-in support for tenant-aware applications.

πŸ’‘ Tips for Success

  1. Start Small: Begin with core extensions and add components as needed
  2. Follow Patterns: Use the SlimBus template as a reference
  3. Test-Driven: Leverage TestContainers for integration tests
  4. Stay Current: Follow semantic versioning for updates

🀝 Getting Help


πŸ’‘ Pro Tip: The SlimBus template provides a complete working example of all DKNet components working together. Use it as your starting point!