25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

28 satır
1.2KB

  1. namespace Campaign_Tracker.Server.ExtensionData;
  2. /// <summary>
  3. /// Immutable value object that an extension record stores as its required legacy foreign reference.
  4. /// Carry the <see cref="LegacyLinkType"/> and the string representation of the join key so
  5. /// the anti-corruption layer can resolve it unambiguously (AC #2).
  6. /// </summary>
  7. public sealed record LegacyLinkReference(LegacyLinkType Type, string Value)
  8. {
  9. public static LegacyLinkReference ForJurisdiction(string jCode)
  10. {
  11. ArgumentException.ThrowIfNullOrWhiteSpace(jCode);
  12. return new(LegacyLinkType.JurisdictionJCode, jCode);
  13. }
  14. public static LegacyLinkReference ForKit(int id) =>
  15. id <= 0
  16. ? throw new ArgumentOutOfRangeException(nameof(id), "Kit ID must be greater than zero.")
  17. : new(LegacyLinkType.KitId, id.ToString(System.Globalization.CultureInfo.InvariantCulture));
  18. public static LegacyLinkReference ForContact(int id) =>
  19. id <= 0
  20. ? throw new ArgumentOutOfRangeException(nameof(id), "Contact ID must be greater than zero.")
  21. : new(LegacyLinkType.ContactId, id.ToString(System.Globalization.CultureInfo.InvariantCulture));
  22. public override string ToString() => $"{Type}:{Value}";
  23. }

Powered by TurnKey Linux.