Tutorials
Comprehensive step-by-step tutorials to help you master JD.Domain. Each tutorial includes working code examples, explanations, and best practices.
Getting Started Tutorials
Start here if you're new to JD.Domain:
Code-First Walkthrough
Time: 45-60 minutes | Level: Beginner
Build a complete e-commerce domain from scratch using JD.Domain's fluent DSL. Learn how to define entities, configure properties, add business rules, and generate EF Core configurations.
What you'll build:
- Customer and Order entities with rules
- EF Core DbContext with generated configurations
- Runtime validation engine
- Rich domain types with construction safety
Prerequisites: Basic C# and EF Core knowledge
Database-First Walkthrough
Time: 30-45 minutes | Level: Beginner
Retrofit business rules onto existing EF Core scaffolded entities from a database. Learn how to add validation without modifying generated code.
What you'll build:
- Domain manifest from scaffolded entities
- Business rules for existing models
- FluentValidation validators (generated)
- ASP.NET Core API with automatic validation
Prerequisites: Existing EF Core project or database
Hybrid Workflow
Time: 60-90 minutes | Level: Intermediate
Combine code-first and database-first approaches while tracking domain evolution with snapshots and diffs.
What you'll build:
- Mixed code-first and database-first domain
- Snapshot versioning system
- Breaking change detection
- Migration planning workflow
Prerequisites: Understanding of both code-first and database-first workflows
Feature-Specific Tutorials
Deep dives into specific JD.Domain features:
Domain Modeling
Time: 45 minutes | Level: Beginner-Intermediate
Master the domain modeling DSL for defining entities, value objects, and enums with properties, keys, and relationships.
Topics covered:
- Entity definitions with properties
- Value object patterns
- Enumeration types
- Composite keys and indexes
- Relationships and navigation properties
Business Rules
Time: 60 minutes | Level: Intermediate
Learn how to define, compose, and evaluate business rules including invariants, validators, policies, and derivations.
Topics covered:
- Invariants (always-true rules)
- Validators (context-dependent)
- Policies (authorization rules)
- Derivations (computed properties)
- Rule composition and reuse
- Conditional rules with
When
EF Core Integration
Time: 30 minutes | Level: Beginner-Intermediate
Integrate JD.Domain with Entity Framework Core to apply domain configurations to your DbContext.
Topics covered:
- ApplyDomainManifest extension
- Property configuration (required, max length)
- Index configuration (unique, filtered)
- Key configuration (primary, composite)
- Table mapping (name, schema)
ASP.NET Core Integration
Time: 45 minutes | Level: Intermediate
Add automatic request validation to your ASP.NET Core APIs using JD.Domain middleware and endpoint filters.
Topics covered:
- Domain validation middleware
- Endpoint filters for Minimal APIs
- MVC action filters
- ProblemDetails responses (RFC 9457)
- Custom error handling
- DomainContext for user/tenant context
Source Generators
Time: 60 minutes | Level: Intermediate-Advanced
Use JD.Domain source generators to create rich domain types and FluentValidation validators automatically.
Topics covered:
- Domain model generator (construction-safe types)
- FluentValidation generator
- Generated code structure
- Customizing generator options
- Partial class extension points
- Troubleshooting generator issues
Version Management
Time: 45 minutes | Level: Intermediate
Track domain evolution over time using snapshots, compare versions with diffs, and generate migration plans.
Topics covered:
- Creating domain snapshots
- Comparing snapshots with DiffEngine
- Breaking vs. non-breaking changes
- Generating migration plans
- CLI tools for CI/CD integration
- Canonical JSON serialization
Tutorial Series
Follow these series for comprehensive learning:
Beginner Series (3-4 hours total)
Perfect for developers new to JD.Domain:
- Code-First Walkthrough - Foundations
- Domain Modeling - Deep dive into DSL
- Business Rules - Rule system mastery
- EF Core Integration - Database integration
Outcome: Build production-ready domain models with validation
Database Modernization Series (2-3 hours total)
For teams working with existing databases:
- Database-First Walkthrough - Add rules to legacy code
- ASP.NET Core Integration - API validation
- Source Generators - Generate rich wrappers
- Hybrid Workflow - Gradual migration path
Outcome: Modernize legacy applications incrementally
Advanced Series (3-4 hours total)
For teams managing complex domains:
- Hybrid Workflow - Mixed approaches
- Version Management - Track evolution
- Source Generators - Code generation
- ASP.NET Core Integration - Full stack integration
Outcome: Enterprise-grade domain management
Sample Applications
Each tutorial references these working sample applications:
JD.Domain.Samples.CodeFirst
Complete code-first workflow demonstration with:
- Customer and Order entities
- Business rules and validation
- EF Core integration
- Generated domain types
Location: samples/JD.Domain.Samples.CodeFirst/
JD.Domain.Samples.DbFirst
Database-first workflow demonstration with:
- Scaffolded Blog and Post entities
- Added business rules
- FluentValidation generation
- ASP.NET Core API
Location: samples/JD.Domain.Samples.DbFirst/
JD.Domain.Samples.Hybrid
Hybrid workflow demonstration with:
- Mixed code-first and database-first entities
- Snapshot versioning
- Diff comparison
- Migration planning
Location: samples/JD.Domain.Samples.Hybrid/
Tutorial Format
Each tutorial follows a consistent structure:
- Overview - What you'll learn and build
- Prerequisites - Required knowledge and tools
- Setup - Project creation and package installation
- Step-by-Step Instructions - Detailed walkthrough with code
- Explanation - Concepts and design decisions
- Testing - Verify it works
- Summary - Key takeaways
- Next Steps - Where to go from here
How to Use These Tutorials
If You're New to JD.Domain
Start with the Code-First Walkthrough to understand core concepts, then explore feature-specific tutorials based on your needs.
If You Have an Existing Project
Start with the Database-First Walkthrough to learn how to add JD.Domain to existing code without major refactoring.
If You're Evaluating JD.Domain
Follow the Quick Start (5 minutes) to get a taste, then try the Code-First Walkthrough (60 minutes) for a complete picture.
If You're Building Production Systems
Complete the Beginner Series, then follow the Advanced Series to learn best practices for enterprise scenarios.
Additional Learning Resources
- Getting Started - Installation and quick start
- How-To Guides - Task-oriented guides
- Concepts - Deep dives into architecture
- API Reference - Complete API documentation
Get Help
- Questions? Open a GitHub Issue
- Found a bug? Report it on GitHub
- Want to contribute? See our Contributing Guide
Let's get started! Choose your first tutorial above and begin building with JD.Domain.