net-repository-pattern

Implements EF Core repository pattern with Unit of Work for .NET data access.

165|62|Updated Jan 9, 2026
One-click install
npx skills add https://github.com/mitkox/ai-coding-factory --skill net-repository-pattern
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: net-repository-pattern
Source: https://github.com/mitkox/ai-coding-factory/tree/main/.opencode/skill/net-repository-pattern
Command: npx skills add https://github.com/mitkox/ai-coding-factory --skill net-repository-pattern

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill provides a clean, reusable data access layer for .NET projects by implementing a repository pattern with Unit of Work for EF Core. It decouples data access concerns from domain logic, improves testability, and reduces boilerplate across aggregates.

Core Features & Use Cases

  • Generic repository base: A shared base with common CRUD and query capabilities.
  • Specific repositories: Concrete repositories per aggregate (e.g., Product, Order, User).
  • Unit of Work pattern: Coordinated commits across repositories.
  • EF Core integration: DbContext-based data access with EF Core.
  • Specification pattern support: Flexible queries via ISpecification.
  • Use Case: Implement data access layer for multiple aggregates in a clean, maintainable way.

Quick Start

Create a new .NET project, add EF Core and infrastructure layers, implement AppDbContext, add base repository and unit of work, and execute sample queries using the UnitOfWork.

Frequently Asked Questions about net-repository-pattern

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement the repository pattern with Unit of Work in EF Core?

To implement the repository pattern with Unit of Work in EF Core, use a generic IRepository base for CRUD operations and IUnitOfWork to coordinate commits across aggregate-specific repositories like Product, Order, and User.

What is the specification pattern in data access and when do I need it?

The specification pattern in data access encapsulates query logic into reusable ISpecification objects. You need it to decouple complex query criteria from repository implementations, improving testability and reducing boilerplate across multiple aggregates.

How do I decouple domain logic from EF Core data access code?

To decouple domain logic from EF Core data access code, introduce generic repositories and a Unit of Work pattern. This isolates DbContext operations in a separate infrastructure layer, keeping domain logic clean and testable.

Does this repository pattern work with multiple aggregates like Product and Order?

Yes, this repository pattern works with multiple aggregates like Product, Order, and User. It provides concrete specific repositories for each aggregate while sharing common query capabilities through a generic repository base.

How do I set up a .NET project with generic repositories and EF Core?

To set up a .NET project with generic repositories and EF Core, create infrastructure layers, implement AppDbContext, add the generic base repository, define the Unit of Work, and execute sample queries using the UnitOfWork.

Best way to coordinate database commits across multiple repositories in C#?

The best way to coordinate database commits across multiple repositories in C# is using the Unit of Work pattern. It ensures that all changes across different aggregate repositories are committed in a single transaction via IUnitOfWork.