Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

34 wiersze
1.2KB

  1. namespace Campaign_Tracker.Server.LegacyData.Schema;
  2. /// <summary>
  3. /// Abstraction for reading the *current* legacy schema at runtime.
  4. ///
  5. /// In production this is implemented against the live Access database (OleDb
  6. /// schema rowsets). In development and testing it is implemented in-memory and
  7. /// seeded from the baseline so the default state is "no drift". Tests inject
  8. /// mutated inspectors to simulate drift.
  9. /// </summary>
  10. public interface ILegacySchemaInspector
  11. {
  12. Task<IReadOnlyList<LegacyTableDefinition>> GetCurrentSchemaAsync(
  13. CancellationToken cancellationToken = default);
  14. }
  15. /// <summary>
  16. /// Default development/test inspector. Returns whatever table list it was
  17. /// constructed with (defaulting to the baseline tables — no drift).
  18. /// </summary>
  19. public sealed class InMemoryLegacySchemaInspector : ILegacySchemaInspector
  20. {
  21. private readonly IReadOnlyList<LegacyTableDefinition> _tables;
  22. public InMemoryLegacySchemaInspector(IReadOnlyList<LegacyTableDefinition> tables)
  23. {
  24. _tables = tables ?? throw new ArgumentNullException(nameof(tables));
  25. }
  26. public Task<IReadOnlyList<LegacyTableDefinition>> GetCurrentSchemaAsync(
  27. CancellationToken cancellationToken = default) =>
  28. Task.FromResult(_tables);
  29. }

Powered by TurnKey Linux.