Extract the common logic into a separate shared library (e.g., a .ClassLib
project).
Both Project A and Project B reference this library.
If a shared library isn’t possible, use conditional dependency injection:
In Project A, inject the direct implementation (no HTTP).
In Project B, inject the Typed HTTP Client (calls Project A’s API).
Ensures the same logic is executed in both cases.
Unnecessary overhead (network, serialization).
Risk of inconsistency if logic diverges.