Class NpgsqlSchemaProvider
Provides schema-related metadata for a Npgsql (PostgreSQL) database, allowing access to table, column, index, foreign key, and type information. This class implements the ISchemaProvider interface and serves as a provider for PostgreSQL database schemas.
public class NpgsqlSchemaProvider : ISchemaProvider
- Inheritance
-
NpgsqlSchemaProvider
- Implements
- Inherited Members
Constructors
NpgsqlSchemaProvider(string)
Initializes a new instance of the NpgsqlSchemaProvider class.
public NpgsqlSchemaProvider(string connectionString)
Parameters
connectionStringstringThe connection string to use for database access.
Properties
ConnectionString
Gets the connection string used to connect to the database.
public string ConnectionString { get; }
Property Value
DatabaseName
Gets the name of the database for which the schema information is being retrieved.
public string DatabaseName { get; }
Property Value
ProviderName
Gets the name of the database provider.
public string ProviderName { get; }
Property Value
Methods
GetColumnMeta(string, string, string)
Extracts the metadata for a specified column within a table and its owner, including information such as data type, nullability, default values, and other relevant schema details specific to the column.
public MetaData GetColumnMeta(string tableName, string tableOwner, string columnName)
Parameters
tableNamestringThe name of the table containing the column for which to retrieve metadata.
tableOwnerstringThe owner of the table containing the column for which to retrieve metadata.
columnNamestringThe name of the column for which to retrieve metadata.
Returns
GetColumnNames(string, string)
Extracts the names of all columns for a specified table and its owner.
public string[] GetColumnNames(string tableName, string tableOwner)
Parameters
tableNamestringThe name of the table for which to retrieve column names.
tableOwnerstringThe owner of the table for which to retrieve column names.
Returns
- string[]
An array of column names for the specified table and owner.
GetForeignKeyMeta(string, string, string)
Extracts the metadata for a specified foreign key within a table and its owner, including information such as referenced table and columns, foreign key constraints, and other relevant schema details specific to the foreign key relationship.
public MetaData GetForeignKeyMeta(string tableName, string tableOwner, string fkName)
Parameters
tableNamestringThe name of the table containing the foreign key for which to retrieve metadata.
tableOwnerstringThe owner of the table containing the foreign key for which to retrieve metadata.
fkNamestringThe name of the foreign key for which to retrieve metadata.
Returns
GetForeignKeyNames(string, string)
Extracts the names of all foreign keys for a specified table and its owner.
public string[] GetForeignKeyNames(string tableName, string tableOwner)
Parameters
tableNamestringThat name of the table for which to retrieve foreign key names.
tableOwnerstringThe owner of the table for which to retrieve foreign key names.
Returns
- string[]
An array of foreign key names for the specified table and owner.
GetIndexMeta(string, string, string)
Extracts the metadata for a specified index within a table and its owner, including information such as index type, indexed columns, uniqueness, and other relevant schema details specific to the index.
public MetaData GetIndexMeta(string tableName, string tableOwner, string indexName)
Parameters
tableNamestringThe name of the table containing the index for which to retrieve metadata.
tableOwnerstringThe owner of the table containing the index for which to retrieve metadata.
indexNamestringThe name of the index for which to retrieve metadata.
Returns
GetIndexNames(string, string)
Extracts the names of all indexes for a specified table and its owner.
public string[] GetIndexNames(string tableName, string tableOwner)
Parameters
tableNamestringThe name of the table for which to retrieve index names.
tableOwnerstringThe owner of the table for which to retrieve index names.
Returns
- string[]
An array of index names for the specified table and owner.
GetTableMeta(string, string)
Extracts the metadata for a specified table and its owner, including information such as column data types, index definitions, foreign key relationships, and other relevant schema details.
public MetaData GetTableMeta(string tableName, string tableOwner)
Parameters
tableNamestringThe name of the table for which to retrieve metadata.
tableOwnerstringThe owner of the table for which to retrieve metadata.
Returns
GetTableNames()
Extracts the names of all tables in the database, along with their respective owners.
public NameOwnerPair[] GetTableNames()
Returns
- NameOwnerPair[]
An array of NameOwnerPair objects, each containing the name and owner of a table.
GetTypeMeta(string, string)
Extracts the metadata for a specified type and its owner, including information such as type definition, underlying data type, allowed values (for enums), and other relevant schema details specific to the type.
public MetaData GetTypeMeta(string typeName, string typeOwner)
Parameters
typeNamestringThe name of the type for which to retrieve metadata.
typeOwnerstringThe owner of the type for which to retrieve metadata.
Returns
- MetaData
A MetaData object containing the metadata for the specified type and owner. If the database does not support types or if this method is not implemented, it may return an empty MetaData object.
GetTypeNames()
Extracts the names of all types (e.g., user-defined types, enums, etc.) in the database, along with their respective owners. This method is optional and may not be implemented by all database providers, as not all databases support user-defined types or similar constructs.
public NameOwnerPair[] GetTypeNames()
Returns
- NameOwnerPair[]
An array of NameOwnerPair objects, each containing the name and owner of a type in the database. If the database does not support types or if this method is not implemented, it may return an empty array.