Skip to content

Providers

Michael Vivet edited this page Sep 1, 2024 · 27 revisions

Table of Contents


Summary

Providers are what you can call almost required dependencies for most applications.
Even though a provider may be omitted in the application, it's rarely the preferred approach, and not recommended.

The behavior and configuration of providers is defined in sections in appsettings.json file. Their dependencies are registered when building the application, and initialized when the applications starts up.

The different providers are described in the sub-sections.


Registration

To complete the application entry implementation, the dependencies for the providers must be registered.

Nano extends the IServiceCollection, with methods for registering the providers.

Sample Implementation
.ConfigureServices(x =>
{
    x.AddLogging<TProvider>(); // Logging Provider
    x.AddDataContext<TProvider, TContext>(); // Data Provider
    x.AddEventing<TProvider>(); // Eventing Provider
    x.AddStorage<TProvider>(); // Storage Provider
})

BE AWARE: The order of which the dependencies are registered is important. It's recommended to register then provider for logging first, allowing subsequent registrations to access logging. Next, register the data provider, and last the provider for eventing and storage.


Implementations

The supported provider implementations in Nano, can be referenced in the The Appendix - Supported Providers.