ef-core

Guide EF Core migration and LINQ usage for Pomelo MariaDB in .NET 10 projects.

7|Updated Mar 5, 2026
One-click install
npx skills add https://github.com/rloisell/rl-agents-n-skills --skill ef-core-rloisell
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ef-core
Source: https://github.com/rloisell/rl-agents-n-skills/tree/main/ef-core
Command: npx skills add https://github.com/rloisell/rl-agents-n-skills --skill ef-core-rloisell

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Provides clear, production-ready guidance to avoid migration failures, runtime LINQ surprises, and misconfigured DbContext registrations when using EF Core with the Pomelo MariaDB provider.

Core Features & Use Cases

  • Provider setup and recommended NuGet packages for .NET projects using Pomelo.EntityFrameworkCore.MySql.
  • Migration workflow and naming conventions to add, apply, rollback, and safely manage schema changes.
  • Startup auto-migrate guidance and a critical warning to prefer db.Database.Migrate() over EnsureCreated().
  • Workarounds for the Linux LINQ ReadOnlySpan/Contains runtime bug and guidance to use List<string> collections in queries.
  • Service layer patterns, domain exception mappings to HTTP statuses, and testing recommendations using an in-memory database.

Quick Start

Add a migration named InitialCreate to the project and apply it to the database using the Pomelo MariaDB provider.

Frequently Asked Questions about ef-core

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

FAQPage Schema
Why does EF Core migration fail when using the Pomelo MariaDB provider in .NET?

EF Core migration failures with Pomelo MariaDB often stem from using EnsureCreated() instead of db.Database.Migrate() or misconfigured DbContext registrations. This guidance enforces proper migration workflows and DI registration to prevent schema update errors and startup failures.

How do I fix the LINQ Contains runtime bug with EF Core and MariaDB on Linux?

To fix the LINQ Contains runtime bug on Linux, use List<string> collections instead of other enumerable types in your LINQ queries. This prevents the ReadOnlySpan translation issue specific to the Pomelo MariaDB provider environment.

What NuGet packages do I need for EF Core with Pomelo MariaDB in a .NET 10 project?

You need the Microsoft.EntityFrameworkCore and Pomelo.EntityFrameworkCore.MySql NuGet packages for your .NET 10 project. These packages provide the core EF Core functionality and the specific MariaDB database provider implementation.

How do I add and apply an InitialCreate migration using EF Core with MariaDB?

To add and apply an InitialCreate migration with MariaDB, use the standard EF Core migration commands within your project. This guidance provides the correct naming conventions and workflow to safely add, apply, and rollback schema changes.

Can I use an in-memory database for testing with EF Core and Pomelo MariaDB?

Yes, you can use an in-memory database for testing your EF Core data layer. This guidance includes testing recommendations and service-layer patterns to map domain exceptions to HTTP statuses, ensuring robust test configuration.