EF Core Data Persistence Layer - Hexagonal Architecture Adapter

Implements a JUnit 4, 5 and 6 compatible @DataProvider annotation processor.

1|8|Updated Nov 16, 2023
One-click install
npx skills add https://github.com/zlzforever/WildGoose --skill ef-core-data-persistence-layer-hexagonal-architecture-adapter
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: EF Core Data Persistence Layer - Hexagonal Architecture Adapter
Source: https://github.com/zlzforever/WildGoose/tree/main/.claude/data-dotnet
Command: npx skills add https://github.com/zlzforever/WildGoose --skill ef-core-data-persistence-layer-hexagonal-architecture-adapter

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill provides a comprehensive guide and patterns for implementing a data persistence layer using Entity Framework Core within a hexagonal architecture, ensuring clean separation and testability.

Core Features & Use Cases

  • Data Context Configuration: Set up EF Core contexts for production and testing, including migration support.
  • Entity Mapping: Implement patterns for mapping domain objects to database tables using Fluent API.
  • Repository Implementations: Create CQRS-patterned write and query repositories.
  • Unit of Work: Manage transactions across multiple repositories.
  • Dependency Injection: Automate repository registration and validation.
  • Schema Organization: Design multi-schema databases for bounded contexts.
  • Migration Workflow: Best practices for schema changes.
  • Performance Optimization: Techniques for efficient data access.
  • Use Case: Integrate this Skill into a .NET application to manage all database interactions, from saving user data to querying complex reports, following Domain-Driven Design principles.

Quick Start

Register the data services in your application by calling the RegisterDataServices extension method.

Frequently Asked Questions about EF Core Data Persistence Layer - Hexagonal Architecture Adapter

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

FAQPage Schema
How do I implement a data persistence layer with EF Core in hexagonal architecture?

To implement an EF Core persistence layer in hexagonal architecture, configure DbContext, map domain objects via Fluent API, implement CQRS write and query repositories, and manage transactions with Unit of Work for testable data access.

What is the best way to manage transactions across multiple repositories in Domain-Driven Design?

The best way to manage transactions across repositories in DDD is using the Unit of Work pattern, which coordinates saves across multiple repository implementations to ensure transactional consistency and maintainable data persistence.

How do I separate read and write operations in EF Core using CQRS?

To separate read and write operations in EF Core using CQRS, implement distinct write repositories for state changes and query repositories for data retrieval, ensuring clean separation of data access concerns within your persistence adapter.

Does EF Core work with multi-schema databases for bounded contexts?

Yes, EF Core works with multi-schema databases for bounded contexts by applying schema organization patterns and convention-based dependency injection to isolate domain models and automate repository registration.

How do I map domain objects to database tables using EF Core Fluent API?

To map domain objects to database tables using EF Core Fluent API, define entity mapping configurations within your DbContext setup to translate domain entities into database schemas while maintaining clean separation.

Why use convention-based dependency injection for repository registration in .NET?

Use convention-based dependency injection for repository registration in .NET to automate the wiring of repository implementations and validate dependencies, reducing manual errors and ensuring testable, scalable data access.