Class SchemaProvider
A factory class that provides methods to create schema providers and retrieve database schemas based on the specified provider name, connection string, and optional schema filter.
public static class SchemaProvider
- Inheritance
-
SchemaProvider
- Inherited Members
Methods
GetDatabase(ISchemaProvider, string)
Extracts the database schema using the provided ISchemaProvider and optional schema filter, and constructs a Database object representing the schema.
public static Database GetDatabase(ISchemaProvider provider, string schema)
Parameters
providerISchemaProviderAn instance of ISchemaProvider to retrieve schema information from the database.
schemastringA string representing the schema filter (e.g., a specific schema name). If null or whitespace, all schemas will be included.
Returns
- Database
A Database object representing the schema of the database as retrieved by the provider.
GetDatabase(string, string, string)
Extracts the database schema using the specified provider name, connection string, and optional schema filter, and constructs a Database object representing the schema.
public static Database GetDatabase(string providerName, string connectionString, string schema)
Parameters
providerNamestringThe name of the database provider (e.g., "Microsoft.Data.SqlClient", "Oracle.ManagedDataAccess.Client").
connectionStringstringThe connection string to connect to the database.
schemastringA string representing the schema filter (e.g., a specific schema name). If null or whitespace, all schemas will be included.
Returns
- Database
A Database object representing the schema of the database as retrieved by the provider.
GetProvider(string, string)
Gets an instance of ISchemaProvider based on the provided provider name and connection string.
public static ISchemaProvider GetProvider(string providerName, string connectionString)
Parameters
providerNamestringThe name of the database provider (e.g., "Microsoft.Data.SqlClient", "Oracle.ManagedDataAccess.Client").
connectionStringstringThe connection string to connect to the database.
Returns
- ISchemaProvider
An instance of ISchemaProvider corresponding to the specified provider name.
Exceptions
- ArgumentException
Thrown when the provider name is not recognized.