repository-pattern
Repository Pattern Generator
Overview
This skill generates Repositories that provide an abstraction over data access:
- Interface in Domain layer - Defines data access contract
- Implementation in Infrastructure - Uses EF Core
- Per Aggregate Root - Not per entity
- Unit of Work integration - SaveChanges via IUnitOfWork
Quick Reference
| Repository Method | Purpose | Returns |
|---|---|---|
GetByIdAsync |
Retrieve by primary key | Entity? |
GetByXxxAsync |
Retrieve by business key | Entity? |
GetAllAsync |
Retrieve all (use sparingly) | IReadOnlyList<Entity> |
Add |
Track new entity | void |
More from ronnythedev/dotnet-clean-architecture-skills
dotnet-clean-architecture
Scaffolds a complete .NET solution following Clean Architecture principles with proper layer separation (API, Application, Domain, Infrastructure). Creates project structure, dependency injection setup, and cross-cutting concerns configuration.
48dapper-query-builder
Generates optimized read queries using Dapper. Includes multi-mapping for joins, pagination, dynamic filtering, CTEs, and best practices for high-performance data access.
23quartz-background-jobs
Generates scheduled background jobs using Quartz.NET. Includes job definitions, triggers, cron scheduling, dependency injection, and persistent job store configuration.
15unit-testing
Generates unit tests for command and query handlers using xUnit and NSubstitute. Implements Arrange-Act-Assert pattern with comprehensive test coverage for success and failure scenarios.
12cqrs-command-generator
Generates CQRS Commands with Handlers, Validators, and Request DTOs following Clean Architecture patterns. Commands represent actions that modify state and return Result types for proper error handling.
12fluent-validation
Generates FluentValidation validators for commands and queries. Includes common validation rules, custom validators, async validation, and integration with MediatR pipeline behaviors.
11