Skip to content

DbContextResolverX ignores the estate-specific connection string #580

Closed

Description

@StuartFerguson

DbContextResolverX.Resolve(...) in EstateReportingAPI.BusinessLogic/QueryTimingInterceptor.cs computes an estate-specific catalog name but then registers EF with ConfigurationReader.GetConnectionString("TransactionProcessorReadModel") instead of the computed connectionString.

Impact:

  • Estate-scoped reporting queries can hit the wrong database.
  • CI shows repeated 500s in the reporting endpoints with SqlServerRetryingExecutionStrategy retry exhaustion for:
    • MerchantDailyPerformanceSummary
    • TransactionMixSummary
    • RecentActivityReceiptSearchSupportsPaging

Evidence:

  • The resolver builds builder.InitialCatalog = $"{builder.InitialCatalog}-{databaseNameSuffix}".
  • Both UseSharedSqlServer(...) and UseSqlServer(...) ignore that value and use the original connection string.
  • A local build of EstateReportingAPI.sln succeeds after the resolver is patched to use the computed connection string, which confirms the change is compile-safe.

Suggested fix:

  • Use the computed connectionString when registering EstateManagementContext in both branches of the resolver.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions