Skip to content

Add lightweight EF Core provider contrast sample - #25

Merged
balajibashyam merged 4 commits into
mainfrom
feature/ef-core-provider-contrast-sample
Aug 17, 2026
Merged

Add lightweight EF Core provider contrast sample#25
balajibashyam merged 4 commits into
mainfrom
feature/ef-core-provider-contrast-sample

Conversation

@balajibashyam

Copy link
Copy Markdown
Contributor

Summary

Adds a minimal .NET 10 companion sample for the EF Core Testing: SQLite In-Memory vs InMemory Provider — Which One Can You Actually Trust? tutorial.

The sample is a behavioral contrast lab: one EF Core model run against both SQLite in-memory and the EF Core InMemory provider, verifying four concrete relational differences.

What's included

  • New sample: ef-core/testing-sqlite-inmemory-vs-inmemory/ — 11 files

    • Shared Project + TaskItem model with unique (Name, OwnerId) index and DeleteBehavior.Cascade
    • SqliteTestDatabase helper with :memory: connection, Foreign Keys=True, explicit open lifetime
    • InMemoryTestDatabase helper with explicit InMemoryDatabaseRoot and no transaction-warning suppression
    • Four paired provider scenarios: unique constraint, foreign key, transaction rollback, database-side cascade with untracked children
    • 8 deterministic xUnit v3 tests (4 pairs showing InMemory vs SQLite contrast)
    • Deterministic six-line output (no timestamps, GUIDs, SQL, benchmark numbers)
  • Root README: New sample row in the table + updated EF Core tree

  • GitHub Actions: New test-ef-core-provider-contrast job (restore, build, test, package baseline, exact output, boundary checks, artifact scan)

Deliberately omitted (stays in the full tutorial)

Web API, concurrency-provider matrix, SQL Server, PostgreSQL, Testcontainers, migrations, raw SQL, JSON, temporal tables, performance benchmarking, migrations, full-text search, stored procedures.

Versions

  • .NET SDK: 10.0.302
  • Microsoft.EntityFrameworkCore.Sqlite: 10.0.11
  • Microsoft.EntityFrameworkCore.InMemory: 10.0.11
  • xunit.v3 3.2.2, xunit.runner.visualstudio 3.1.5, Microsoft.NET.Test.Sdk 18.8.1

Validation

  • dotnet restore — passed
  • dotnet build --configuration Release — passed (0 errors, 0 warnings)
  • dotnet test --configuration Release — passed (8/8)
  • App output matches the exact six-line expected block
  • Security scan — clean
  • No generated database artifacts

@balajibashyam
balajibashyam merged commit 5b04b7f into main Aug 17, 2026
27 checks passed
@balajibashyam
balajibashyam deleted the feature/ef-core-provider-contrast-sample branch August 17, 2026 09:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant