Storage - Nano-Core/Nano.Library GitHub Wiki
Nano supports cloud storage integration.
The IStorageProvider
is registered during startup, and the implementing type defines the storage provider used in the application.
The Storage
section of the configuration defines storage in the application.
The section is serialized into an instance of StorageOptions
, and injected as dependency during startup, thus available for injection throughout the application.
See Appendix - App Settings - Storage for details about the section and the meaning of the variables.
"Storage": {
"AccountName": null,
"AccountKey": null,
"ShareName": null,
"EnableHealthCheck": true,
"UnhealthyStatus": "Unhealthy"
},
Nano provides several storage providers (and more added on request), so usually there is no need to implement a custom data provider for your application.
Storage providers implements the interface IStorageProvider
. It contains a single method Configure(...)
, that is responsible for handling any configuration and setup required for the storage provider.
The eventing providers currently supported by Nano, can be referenced in the Appendix - Supported Providers.
The storage provider must be registered as dependencies.
Invoke the method .AddStorage<TProvider>();
, using the storage provider implementation as generic type parameters.
.ConfigureServices(x =>
{
x.AddStorage<EasyNetQProvider>();
})
When enabling health-checks in the storage section of the confiugration, the application will be configured with a health-check for the storage provider. When the application starts, a check is made to ensure that the storage provider is up and running, returning a healthy status code when checked.
The health status of the application, including the storage provider, can be found here:
http://{host}:{port}/healthz
When building the storage provider, dependencies related to eventing is configured and initialized.
Nano.Storage.StorageOptions
Nano.Storage.Interfaces.IStorageProvider
For a full list of services and dependencies, see Injected Dependencies