coreex-repository

Creates and modifies CoreEx Infrastructure-layer repositories with CRUD operations, mappers, and query configurations.

28|8|Updated Feb 21, 2022
One-click install
npx skills add https://github.com/Avanade/CoreEx --skill coreex-repository-avanade
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: coreex-repository
Source: https://github.com/Avanade/CoreEx/tree/main/.github/skills/coreex-repository
Command: npx skills add https://github.com/Avanade/CoreEx --skill coreex-repository-avanade

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Building data-access repositories in a CoreEx-based .NET solution involves many framework-specific conventions — EfDb accessors, BiDirectionMapper rules, QueryArgsConfig filtering, and Result<T> pipelines — that are easy to get wrong without deep knowledge of the framework. ## Core Features & Use Cases - Repository Scaffolding: Generate a new repository class with [ScopedService] DI registration, EfDb accessors, and a bidirectional Contract ↔ Persistence mapper. - CRUD & Query Operations: Add Get/Create/Update/Delete methods using EfDb delegate shortcuts, or build dynamic filtered/ordered queries with QueryArgsConfig<TSelf>. - Result<T> Pipelines: Implement railway-oriented *WithResultAsync variants for projects using explicit failure propagation. - Use Case: Ask the assistant to add a Product repository with a query supporting case-insensitive SKU filtering and default ordering, and it produces the repository, mapper, EfDb accessor, and query config following CoreEx conventions. ## Quick Start Ask the assistant to create a new CoreEx repository for your entity, specifying the database type and which CRUD or query operations you need.

Frequently Asked Questions about coreex-repository

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

FAQPage Schema
How do I create a CoreEx repository class in .NET?▼

Create a class in Infrastructure/Repositories with a primary constructor taking the EfDb accessor, annotate it with [ScopedService<IYourRepository>] for automatic DI registration, and delegate CRUD calls to the EfDb model methods like GetAsync and CreateAsync.

How do I add dynamic filtering to a CoreEx query?▼

Create a dedicated QueryArgsConfig<TSelf> class per entity defining filter fields, operators, and ordering in its constructor, then call .Default.Parse(query).ThrowOnError() in the repository method and apply .Where(parsed) and .OrderBy(parsed) to the LINQ query.

Does CoreEx repository support both PostgreSQL and SQL Server?▼

Yes. PostgreSQL projects use CoreEx.Database.Postgres with PostgresDatabase and UseNpgsql, while SQL Server projects use CoreEx.Database.SqlServer with SqlServerDatabase and UseSqlServer. Check the project's Program.cs to confirm the configured provider.

When should I not use this repository skill?▼

Do not use it for Application-layer service logic, domain aggregates or entities, or persistence model creation. Persistence models are generated by the *.Database CodeGen tooling, and services should consume repository interfaces rather than modify Infrastructure.

Why must ETag and ChangeLog not be mapped in BiDirectionMapper?▼

The base BiDirectionMapper owns ETag and ChangeLog mapping automatically, so mapping them in OnMap overrides causes conflicts. You must map Id and all domain-specific properties explicitly, since the base does not auto-map Id.