2026-05-20 comparisonef-coredapper EF Core 11 vs Dapper for bulk inserts: real benchmark For bulk inserts in .NET 11, neither EF Core nor Dapper wins. SqlBulkCopy does. This is the benchmark, the why, and the seat each tool deserves.
2026-05-14 errorscsharpdotnet Fix: A possible object cycle was detected System.Text.Json refuses to serialize graphs with back-references. Set ReferenceHandler.IgnoreCycles, project to a DTO, or mark the back-pointer with [JsonIgnore]. Preserve is a last resort.
2026-05-14 errorscsharpdotnet Fix: SqlException: Timeout expired during EF Core migrations Migrations use the design-time DbContext, not your runtime CommandTimeout. Set the timeout via UseSqlServer(o => o.CommandTimeout(...)), the connection string Command Timeout, or Database.SetCommandTimeout before Migrate().
2026-05-11 errorscsharpdotnet Fix: dotnet ef migrations add fails with 'Unable to create an object of type DbContext' EF Core's design-time tools could not instantiate your DbContext. Either expose a host via WebApplication.CreateBuilder, point to the right startup project, or implement IDesignTimeDbContextFactory.
2026-05-07 errorscsharpdotnet Fix: The instance of entity type cannot be tracked because another instance with the same key value is already being tracked EF Core 11 throws when two objects share a primary key inside one DbContext. Detach the old one or update it in place. AsNoTracking on the read prevents the collision.
2026-05-07 errorscsharpdotnet Fix: A second operation was started on this context instance before a previous operation completed EF Core throws when two awaits run in parallel on the same DbContext. Await each call sequentially, or get a new DbContext per concurrent unit of work via IDbContextFactory.
2026-05-05 errorscsharpdotnet Fix: System.InvalidOperationException: No connection string named 'DefaultConnection' could be found If GetConnectionString returns null in .NET 11, your appsettings.json is missing the key, not copied to the build output, or the wrong environment file is being selected. Three checks fix 95% of cases.
2026-05-05 mcpai-agentsef-core How to Expose an EF Core Database to an AI Agent via MCP Wire an EF Core 10 DbContext into a Model Context Protocol server so Claude Code, Cursor, or any compliant client can run safe, scoped queries against your database. Covers IDbContextFactory lifetime, read-only projections, schema discovery tools, AsNoTracking, parameterised filters, row-level scoping, and the destructive-tool gates you need before letting an agent touch UPDATE.
2026-05-02 ef-coreef-core-11csharp How to detect N+1 queries in EF Core 11 A practical guide to spotting N+1 queries in EF Core 11: what the pattern looks like in real code, how to surface it via logging, diagnostic interceptors, OpenTelemetry, and a test that fails the build when a hot path regresses.
2026-05-02 ef-coreef-core-11csharp How to use compiled queries with EF Core for hot paths A practical guide to EF Core 11 compiled queries: when EF.CompileAsyncQuery actually wins, the static-field pattern, the Include and tracking gotchas, and how to benchmark before and after so you can prove it was worth the extra ceremony.