Class DbProviderFactoryCreator
Provides methods for creating instances of database provider factories used by Umbraco CMS.
Inheritance
Namespace: Umbraco.Cms.Infrastructure.Persistence
Assembly: Umbraco.Infrastructure.dll
Syntax
public class DbProviderFactoryCreator : IDbProviderFactoryCreator
Constructors
View SourceDbProviderFactoryCreator(Func<string, DbProviderFactory>, IEnumerable<ISqlSyntaxProvider>, IEnumerable<IBulkSqlInsertProvider>, IEnumerable<IDatabaseCreator>, IEnumerable<IProviderSpecificMapperFactory>, IEnumerable<IProviderSpecificInterceptor>)
Initializes a new instance of the DbProviderFactoryCreator class.
Declaration
public DbProviderFactoryCreator(Func<string, DbProviderFactory> getFactory, IEnumerable<ISqlSyntaxProvider> syntaxProviders, IEnumerable<IBulkSqlInsertProvider> bulkSqlInsertProviders, IEnumerable<IDatabaseCreator> databaseCreators, IEnumerable<IProviderSpecificMapperFactory> providerSpecificMapperFactories, IEnumerable<IProviderSpecificInterceptor> providerSpecificInterceptors)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<string, DbProviderFactory> | getFactory | A function that retrieves a System.Data.Common.DbProviderFactory based on the specified provider name. |
| IEnumerable<ISqlSyntaxProvider> | syntaxProviders | A collection of ISqlSyntaxProvider instances representing SQL syntax providers for different database types. |
| IEnumerable<IBulkSqlInsertProvider> | bulkSqlInsertProviders | A collection of IBulkSqlInsertProvider instances used for bulk SQL insert operations. |
| IEnumerable<IDatabaseCreator> | databaseCreators | A collection of IDatabaseCreator instances responsible for creating databases for specific providers. |
| IEnumerable<IProviderSpecificMapperFactory> | providerSpecificMapperFactories | A collection of IProviderSpecificMapperFactory instances for creating provider-specific mappers. |
| IEnumerable<IProviderSpecificInterceptor> | providerSpecificInterceptors | A collection of IProviderSpecificInterceptor instances for handling provider-specific interception logic. |
Methods
View SourceCreateBulkSqlInsertProvider(string)
Creates an IBulkSqlInsertProvider instance for the specified provider name.
Declaration
public IBulkSqlInsertProvider CreateBulkSqlInsertProvider(string providerName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | providerName | The name of the database provider. |
Returns
| Type | Description |
|---|---|
| IBulkSqlInsertProvider | An IBulkSqlInsertProvider corresponding to the provider name. |
CreateDatabase(string, string)
Creates a database using the specified provider name and connection string by delegating to the appropriate database creator.
Declaration
public void CreateDatabase(string providerName, string connectionString)
Parameters
| Type | Name | Description |
|---|---|---|
| string | providerName | The name of the database provider to use for creation. |
| string | connectionString | The connection string to use when creating the database. |
Remarks
If the specified provider is not registered, no action is taken.
CreateFactory(string?)
Creates a System.Data.Common.DbProviderFactory instance for the specified provider name.
Declaration
public DbProviderFactory? CreateFactory(string? providerName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | providerName | The name of the provider for which to create the factory. |
Returns
| Type | Description |
|---|---|
| DbProviderFactory | The System.Data.Common.DbProviderFactory instance if the provider name is valid; otherwise, |
GetProviderSpecificInterceptors(string)
Returns the provider-specific interceptors associated with the specified provider name.
Declaration
public IEnumerable<IProviderSpecificInterceptor> GetProviderSpecificInterceptors(string providerName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | providerName | The name of the database provider to match. |
Returns
| Type | Description |
|---|---|
| IEnumerable<IProviderSpecificInterceptor> | An enumerable collection of IProviderSpecificInterceptor instances for the given provider. |
GetSqlSyntaxProvider(string)
Gets the SQL syntax provider that corresponds to the specified provider name.
Declaration
public ISqlSyntaxProvider GetSqlSyntaxProvider(string providerName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | providerName | The name of the database provider. |
Returns
| Type | Description |
|---|---|
| ISqlSyntaxProvider | An Umbraco.Cms.Infrastructure.Persistence.ISqlSyntaxProvider instance for the specified provider. |
Remarks
gets the sql syntax provider that corresponds, from attribute
ProviderSpecificMappers(string)
Returns the collection of NPoco mappers that are specific to the provided database provider name.
Declaration
public NPocoMapperCollection ProviderSpecificMappers(string providerName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | providerName | The name of the database provider for which to retrieve NPoco mappers. |
Returns
| Type | Description |
|---|---|
| NPocoMapperCollection | A NPocoMapperCollection containing the mappers associated with the specified provider, or an empty collection if no provider-specific mappers are registered. |