dotnet-migrate-repo-controller-to-data-service

Migrate a GenericRepositoryApiController to a Pattern 2 controller service for Blazor SSR.

8|1|Updated Feb 5, 2018
One-click install
npx skills add https://github.com/umbrella-libraries/Umbrella --skill dotnet-migrate-repo-controller-to-data-service
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dotnet-migrate-repo-controller-to-data-service
Source: https://github.com/umbrella-libraries/Umbrella/tree/main/.ai-shared/skills/dotnet-migrate-repo-controller-to-data-service
Command: npx skills add https://github.com/umbrella-libraries/Umbrella --skill dotnet-migrate-repo-controller-to-data-service

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Migrate an existing Pattern 1 API controller (inheriting GenericRepositoryApiController, direct repository access) to a Pattern 2 controller that is backed by a dedicated controller service, enabling Blazor SSR pre-rendering and centralizing CRUD hooks.

Core Features & Use Cases

  • Structured migration workflow: Create or adapt the controller service, rewrite the controller to delegate to the service, and rewire DI across the project.
  • Lifecycle hook relocation: Move AfterCreateEntityAsync, AfterUpdateEntityAsync, and AfterDeleteEntityAsync logic into the service to simplify controllers and ensure testability.
  • DI & project conventions: Aligns interfaces and DI registrations with existing Umbrella patterns, including optional client service interfaces and ReplaceScoped/AddScoped strategies.

Quick Start

Follow the migration steps to convert a Pattern 1 API controller to a Pattern 2 data-service-backed controller and wire the controller service into the DI container.

Frequently Asked Questions about dotnet-migrate-repo-controller-to-data-service

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

FAQPage Schema
How do I migrate a repository controller to a data-service controller in ASP.NET Core?

Migrating a repository controller to a data-service controller involves rewriting a GenericRepositoryApiController to delegate to a dedicated service, relocating lifecycle hooks, and wiring dependency injection to enable Blazor SSR pre-rendering.

Why do I need a controller service for Blazor SSR pre-rendering in an existing API?

A controller service is needed for Blazor SSR pre-rendering because it centralizes CRUD hooks and separates data access logic from the controller, allowing the server to render components efficiently without direct repository dependencies.

What is the best way to move AfterCreateEntityAsync hooks during a repository pattern migration?

The best way to move AfterCreateEntityAsync, AfterUpdateEntityAsync, and AfterDeleteEntityAsync hooks is to relocate them directly into the newly created controller service, simplifying the controller and ensuring the logic remains testable.

How do I wire dependency injection when converting a generic repository controller to a data service?

Wiring dependency injection during conversion requires aligning interfaces with existing project conventions using ReplaceScoped or AddScoped strategies, and registering the new controller service across the server and optional client projects.

Can I use full concrete model types instead of interfaces when migrating to a Pattern 2 data-service controller?

Yes, the migration satisfies Umbrella conventions by using full concrete model types and 11 generic parameters across the server, ensuring the Pattern 2 data-service controller maintains strict typing throughout the CRUD operations.

What are the limitations of migrating a GenericRepositoryApiController to a Pattern 2 controller?

The migration is limited to existing projects using a GenericRepositoryApiController and requires strict adherence to Umbrella conventions, meaning projects without these specific repository patterns or generic parameters may not be compatible.