abp-ef-core

Implements ABP Framework EF Core repositories, entity configurations, migrations, and data seeding.

Updated Jul 21, 2026
One-click install
npx skills add https://github.com/afonsoft/gamehub --skill abp-ef-core-afonsoft
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: abp-ef-core
Source: https://github.com/afonsoft/gamehub/tree/main/.claude/skills/abp-ef-core
Command: npx skills add https://github.com/afonsoft/gamehub --skill abp-ef-core-afonsoft

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Working with Entity Framework Core in ABP Framework projects requires following specific conventions like ConfigureByConvention, aggregate-root-only repositories, and proper migration workflows. This Skill provides the correct patterns and commands so you avoid common mistakes that break DDD consistency or ABP conventions. ## Core Features & Use Cases - DbContext and Entity Configuration: Set up AbpDbContext with ConfigureByConvention, table prefixes, indexes, relationships, and property constraints. - Custom Repository Implementation: Build EfCoreRepository classes with IncludeDetails extension methods, WithDetailsAsync overrides, and proper cancellation token handling. - Migrations and Data Seeding: Run dotnet ef migrations commands, apply them via the DbMigrator project, and seed data with IDataSeedContributor. - Use Case: You need to add a new Book entity to your ABP application. Use this Skill to configure the entity mapping, create the custom repository with a FindByNameAsync method, generate the migration, and seed initial data. ## Quick Start Ask the AI to create a new entity with its EF Core configuration, repository, and migration in your ABP EntityFrameworkCore project.

Frequently Asked Questions about abp-ef-core

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

FAQPage Schema
How do I add a migration in an ABP Framework project?▼

Navigate to the EntityFrameworkCore project and run dotnet ef migrations add MigrationName. Apply it with the DbMigrator project, which also seeds data, or use dotnet ef database update. ABP templates include IDesignTimeDbContextFactory, so no startup project parameter is needed.

How do I create a custom repository in ABP EF Core?▼

Inherit from EfCoreRepository<TDbContext, TEntity, TKey> and implement your custom interface. Use GetDbSetAsync for queries, GetCancellationToken for cancellation, and override WithDetailsAsync to define default includes for the aggregate.

Should I use AddDefaultRepositories with includeAllEntities true?▼

No. Setting includeAllEntities to true creates repositories for child entities, allowing them to be modified without going through the aggregate root. This breaks DDD data consistency rules. Use AddDefaultRepositories() for aggregate roots only.

Why is ConfigureByConvention important in ABP entity configuration?▼

ConfigureByConvention applies ABP standard conventions like audit properties, soft delete, and extra properties to your entity mapping. Always call it first inside the Entity configuration block before adding your own property, index, and relationship settings.

Can I access the raw DbContext in an ABP repository?▼

Yes, inside a custom repository call GetDbContextAsync to access the DbContext directly. This enables raw SQL via Database.ExecuteSqlRawAsync. Never inject DbContext into application or domain services; use IRepository abstractions instead.