# Depend On Contracts, Not Providers

Keeps services and controllers on interfaces so the storage provider stays swappable.

Follow these project instructions.
# Depend On Contracts, Not Providers

Keeps services and controllers on interfaces so the storage provider stays swappable.

Version: `1.0.0`

Depend on the contract interface, never on the package that implements it. A service takes a repository interface; a controller takes a service interface. The concrete Azure Table, Entity Framework or other provider type is chosen once, at registration, and is invisible everywhere else.

That is what makes the provider swappable, and what makes the layer testable: a fake implementing the interface is trivial, while a fake implementing a provider's entity model is not.

Watch the return types as much as the parameters. A service that returns a provider entity has coupled every caller to that provider just as firmly as if it had injected it, and the leak is harder to spot because the signature still mentions only your own namespace.

Keep provider choice at the composition root - the registration extension method - so that reading that one file tells you what the application is actually running on.

#### Constraints
- Do not return a provider-specific entity from a service or an endpoint.
- Never inject a concrete provider or store type into a service or controller.

#### Verification
- A fake implementing the interface is enough to test the layer
- No provider package type appears in a service or controller signature
- The provider is named only at registration
