Nucleus .Net Core CMS

DataProviderExtensions Class

Namespace: Nucleus.Data.Common
Assembly: Nucleus.Data.Common.dll
Common data provider dependency injection registration extension methods.

Fields

_cachedDatabaseProviders Field

Cache for list of types which implement IDatabaseProvider. These are cached so that we don't iterate assemblies and types multiple times during startup (every time AddDataProvider is called).

Methods

GetDatabaseProviders

GetDatabaseProviders ()
Find IDatabaseProvider implementations.

AddDataProvider<TDataProvider> (IServiceCollection,IConfiguration) Method

AddDataProvider<TDataProvider> (IServiceCollection services, IConfiguration configuration)
Add data provider objects to the service collection for the data provider specified by TDataProvider. This overload uses the default schema name for the data provider type.
Type Parameters
TDataProvider
Remarks
Data providers which are based on Nucleus.Data.EntityFramework do not need to call this directly - it is called by the Nucleus.Data.EntityFramework.DataProviderExtensions.AddDataProvider() methods.

AddDataProvider<TDataProvider> (IServiceCollection,IConfiguration,String) Method

AddDataProvider<TDataProvider> (IServiceCollection services, IConfiguration configuration, String schemaName)
Add data provider objects to the service collection for the data provider specified by TDataProvider. This overload allows callers to specify their schema name instead of using the default.
Type Parameters
TDataProvider
Remarks
This overload is used when developers want to specify their schema name instead of using the default.

AddDataProvider<TDataProvider> (IServiceCollection,IConfiguration,String,Boolean) Method

AddDataProvider<TDataProvider> (IServiceCollection services, IConfiguration configuration, String schemaName, Boolean canUseDefault)
Add data provider objects to the service collection for the data provider specified by TDataProvider. This overload allows callers to specify their schema name instead of using the default.
Type Parameters
TDataProvider
Remarks
This overload is used when developers want to specify their schema name, but want Nucleus to "fall back" to using the default.

GetDataProviderInformation (DatabaseOptions,String) Method

GetDataProviderInformation (DatabaseOptions options, String schemaName)
Get database diagnostics information for the specified schema.
Parameters
Name Type
options Nucleus.Abstractions.Models.Configuration.DatabaseOptions
schemaName String

AddDataProviderFactory (IServiceCollection,IConfiguration) Method

AddDataProviderFactory (IServiceCollection services, IConfiguration configuration)
Add the default data provider factory to the services collection.

CleanupDataProviderExtensions (IServiceCollection) Method

CleanupDataProviderExtensions (IServiceCollection services)
Clear cache after startup to save memory.

GetDefaultSchemaName (Type) Method

GetDefaultSchemaName (Type type)
Return the default namespace for a type.
Parameters
Name Type
type Type
Remarks
The specified type would typically be a data provider. The default schema name is derived by returning the part of the namespace before ".DataProvider". If the namespace does not contain ".DataProvider", this function returns an empty string. The convention for modules is to us a namespace with ".DataProviders" (plural), but using ".DataProvider" (singular) as the search value handles both plural and singular cases.