[BD-847] Migrate from Dapper to Entity Framework Core#21
Merged
Ranganathan-code-ops merged 2 commits intomainfrom Feb 13, 2026
Merged
Conversation
6 tasks
Replace Dapper ORM with Entity Framework Core for multi-database support (SQL Server, MySQL, PostgreSQL). Move all SQL-specific date/time logic to C# application layer for database portability. Changes: - Add EF Core entities mapping to production tables - Add OrderMonitorDbContext with fluent relationship configuration - Add DatabaseProviderFactory for multi-provider support - Add EfCoreOrderRepository implementing IOrderRepository via LINQ - Add IDiagnosticsService and implementation using EF Core - Update DI registration for EF Core services - Update DiagnosticsController to use service abstraction - Remove Dapper, SqlConnectionFactory, and IDbConnectionFactory - Add 37 new unit tests (entities, DbContext, repository, factory) - Update integration test factory with InMemory DbContext 189 tests passing (154 unit + 35 integration) Closes BD-847, BD-863, BD-864, BD-865, BD-866, BD-867, BD-868, BD-869, BD-870 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1d97f0b to
8860f73
Compare
Add Testcontainers-based integration tests validating EfCoreOrderRepository against real MySQL 8.0 and PostgreSQL 16 databases. Add performance benchmarks with 500 seeded orders confirming sub-2s query times. Changes: - Add DatabaseProviderTestBase with shared test scenarios (11 tests) - Add MySqlProviderTests running against Docker MySQL 8.0 - Add PostgreSqlProviderTests running against Docker PostgreSQL 16 - Add QueryPerformanceTests with 5 benchmarks (500 orders, <2s threshold) - Add Testcontainers.MySql, Testcontainers.PostgreSql, EF Core provider packages 211 tests passing (154 unit + 35 integration + 22 provider) All 5 benchmarks within threshold (<443ms worst case) Closes BD-871, BD-872, BD-873 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Migrate from Dapper to Entity Framework Core for multi-database support and improved maintainability.
DatabaseProviderFactoryOrderMonitorDbContextwith fluent relationship configuration andNoTrackingdefaultEfCoreOrderRepositoryusing pure LINQ (zero raw SQL in repository layer)IDiagnosticsServiceabstraction replacing directIDbConnectionFactoryusageSqlConnectionFactory, andIDbConnectionFactoryTest Results
Files Changed
New (19 files):
Data/Entities/- 6 entity classesData/OrderMonitorDbContext.cs- EF Core DbContextData/DatabaseProviderFactory.cs- Multi-provider factoryData/EfCoreOrderRepository.cs- LINQ-based repositoryData/DiagnosticsService.cs+IDiagnosticsService.csModified (6 files):
DiagnosticsController.cs- Use service abstractionDependencyInjection.cs- EF Core DI registrationInfrastructure.csproj- EF Core packagesDeleted (5 files):
OrderRepository.cs,SqlConnectionFactory.cs,IDbConnectionFactory.csOrderRepositoryTests.cs,SqlConnectionFactoryTests.csCloses
BD-847, BD-863, BD-864, BD-865, BD-866, BD-867, BD-868, BD-869, BD-870, BD-871, BD-872, BD-873
🤖 Generated with Claude Code