Class SchemaProviderBase
- Namespace
- LinqToDB.SchemaProvider
- Assembly
- linq2db.dll
public abstract class SchemaProviderBase : ISchemaProvider
- Inheritance
-
SchemaProviderBase
- Implements
- Derived
- Extension Methods
Fields
DataTypesSchema
protected DataTable DataTypesSchema
Field Value
ExcludedCatalogs
protected HashSet<string?> ExcludedCatalogs
Field Value
ExcludedSchemas
protected HashSet<string?> ExcludedSchemas
Field Value
GenerateChar1AsString
protected bool GenerateChar1AsString
Field Value
IncludedCatalogs
protected HashSet<string?> IncludedCatalogs
Field Value
IncludedSchemas
protected HashSet<string?> IncludedSchemas
Field Value
Properties
GetProcedureSchemaExecutesProcedure
If true, provider doesn't support schema-only procedure execution and will execute procedure for real.
protected virtual bool GetProcedureSchemaExecutesProcedure { get; }
Property Value
Methods
BuildProcedureParameter(ParameterSchema)
protected virtual DataParameter BuildProcedureParameter(ParameterSchema p)
Parameters
Returns
BuildSchemaFilter(GetSchemaOptions?, string, Action<StringBuilder, string>)
protected string? BuildSchemaFilter(GetSchemaOptions? options, string defaultSchema, Action<StringBuilder, string> stringLiteralBuilder)
Parameters
options
GetSchemaOptionsdefaultSchema
stringstringLiteralBuilder
Action<StringBuilder, string>
Returns
BuildTableFunctionLoadTableSchemaCommand(ProcedureSchema, string)
Builds table function call command.
protected virtual string BuildTableFunctionLoadTableSchemaCommand(ProcedureSchema procedure, string commandText)
Parameters
procedure
ProcedureSchemacommandText
string
Returns
ForeignKeyColumnComparison(string)
protected virtual StringComparison ForeignKeyColumnComparison(string column)
Parameters
column
string
Returns
GetColumns(DataConnection, GetSchemaOptions)
protected abstract List<ColumnInfo> GetColumns(DataConnection dataConnection, GetSchemaOptions options)
Parameters
dataConnection
DataConnectionoptions
GetSchemaOptions
Returns
GetDataSourceName(DataConnection)
protected virtual string GetDataSourceName(DataConnection dbConnection)
Parameters
dbConnection
DataConnection
Returns
GetDataType(string?, DataType?, GetSchemaOptions)
protected virtual DataTypeInfo? GetDataType(string? typeName, DataType? dataType, GetSchemaOptions options)
Parameters
typeName
stringdataType
DataType?options
GetSchemaOptions
Returns
GetDataType(string?, string?, int?, int?, int?)
protected abstract DataType GetDataType(string? dataType, string? columnType, int? length, int? precision, int? scale)
Parameters
Returns
GetDataTypeByProviderDbType(int, GetSchemaOptions)
protected DataTypeInfo? GetDataTypeByProviderDbType(int typeId, GetSchemaOptions options)
Parameters
typeId
intoptions
GetSchemaOptions
Returns
GetDataTypes(DataConnection)
Returns list of database data types.
protected virtual List<DataTypeInfo> GetDataTypes(DataConnection dataConnection)
Parameters
dataConnection
DataConnectionDatabase connection instance.
Returns
- List<DataTypeInfo>
List of database data types.
GetDatabaseName(DataConnection)
protected virtual string GetDatabaseName(DataConnection dbConnection)
Parameters
dbConnection
DataConnection
Returns
GetDbType(GetSchemaOptions, string?, DataTypeInfo?, int?, int?, int?, string?, string?, string?)
protected virtual string? GetDbType(GetSchemaOptions options, string? columnType, DataTypeInfo? dataType, int? length, int? precision, int? scale, string? udtCatalog, string? udtSchema, string? udtName)
Parameters
options
GetSchemaOptionscolumnType
stringdataType
DataTypeInfolength
int?precision
int?scale
int?udtCatalog
stringudtSchema
stringudtName
string
Returns
GetForeignKeys(DataConnection, IEnumerable<TableSchema>, GetSchemaOptions)
protected abstract IReadOnlyCollection<ForeignKeyInfo> GetForeignKeys(DataConnection dataConnection, IEnumerable<TableSchema> tables, GetSchemaOptions options)
Parameters
dataConnection
DataConnectiontables
IEnumerable<TableSchema>options
GetSchemaOptions
Returns
GetHashSet(string?[]?, IEqualityComparer<string?>)
protected static HashSet<string?> GetHashSet(string?[]? data, IEqualityComparer<string?> comparer)
Parameters
data
string[]comparer
IEqualityComparer<string>
Returns
GetPrimaryKeys(DataConnection, IEnumerable<TableSchema>, GetSchemaOptions)
protected abstract IReadOnlyCollection<PrimaryKeyInfo> GetPrimaryKeys(DataConnection dataConnection, IEnumerable<TableSchema> tables, GetSchemaOptions options)
Parameters
dataConnection
DataConnectiontables
IEnumerable<TableSchema>options
GetSchemaOptions
Returns
GetProcedureParameters(DataConnection, IEnumerable<ProcedureInfo>, GetSchemaOptions)
protected virtual List<ProcedureParameterInfo>? GetProcedureParameters(DataConnection dataConnection, IEnumerable<ProcedureInfo> procedures, GetSchemaOptions options)
Parameters
dataConnection
DataConnectionprocedures
IEnumerable<ProcedureInfo>options
GetSchemaOptions
Returns
GetProcedureResultColumns(DataTable, GetSchemaOptions)
protected virtual List<ColumnSchema> GetProcedureResultColumns(DataTable resultTable, GetSchemaOptions options)
Parameters
resultTable
DataTableoptions
GetSchemaOptions
Returns
GetProcedureSchema(DataConnection, string, CommandType, DataParameter[], GetSchemaOptions)
protected virtual DataTable? GetProcedureSchema(DataConnection dataConnection, string commandText, CommandType commandType, DataParameter[] parameters, GetSchemaOptions options)
Parameters
dataConnection
DataConnectioncommandText
stringcommandType
CommandTypeparameters
DataParameter[]options
GetSchemaOptions
Returns
GetProcedures(DataConnection, GetSchemaOptions)
protected virtual List<ProcedureInfo>? GetProcedures(DataConnection dataConnection, GetSchemaOptions options)
Parameters
dataConnection
DataConnectionoptions
GetSchemaOptions
Returns
GetProviderSpecificProcedures(DataConnection)
protected virtual List<ProcedureSchema>? GetProviderSpecificProcedures(DataConnection dataConnection)
Parameters
dataConnection
DataConnection
Returns
GetProviderSpecificTables(DataConnection, GetSchemaOptions)
protected virtual List<TableSchema>? GetProviderSpecificTables(DataConnection dataConnection, GetSchemaOptions options)
Parameters
dataConnection
DataConnectionoptions
GetSchemaOptions
Returns
GetProviderSpecificType(string?)
protected virtual string? GetProviderSpecificType(string? dataType)
Parameters
dataType
string
Returns
GetProviderSpecificTypeNamespace()
protected abstract string? GetProviderSpecificTypeNamespace()
Returns
GetSchema(DataConnection, GetSchemaOptions?)
Returns database schema. Note that it is recommended to call this method outside of transaction as some providers do not support it or behave incorrectly. At least following providers shouldn't be called in transaction:
- MySQL;
- Microsoft SQL Server;
- Sybase;
- DB2.
public virtual DatabaseSchema GetSchema(DataConnection dataConnection, GetSchemaOptions? options = null)
Parameters
dataConnection
DataConnectionData connection to use to read schema from.
options
GetSchemaOptionsSchema read configuration options.
Returns
- DatabaseSchema
Returns database schema information.
GetSystemType(string?, string?, DataTypeInfo?, int?, int?, int?, GetSchemaOptions)
protected virtual Type? GetSystemType(string? dataType, string? columnType, DataTypeInfo? dataTypeInfo, int? length, int? precision, int? scale, GetSchemaOptions options)
Parameters
dataType
stringcolumnType
stringdataTypeInfo
DataTypeInfolength
int?precision
int?scale
int?options
GetSchemaOptions
Returns
GetTables(DataConnection, GetSchemaOptions)
protected abstract List<TableInfo> GetTables(DataConnection dataConnection, GetSchemaOptions options)
Parameters
dataConnection
DataConnectionoptions
GetSchemaOptions
Returns
InitProvider(DataConnection)
protected virtual void InitProvider(DataConnection dataConnection)
Parameters
dataConnection
DataConnection
LoadProcedureTableSchema(DataConnection, GetSchemaOptions, ProcedureSchema, string, List<TableSchema>)
protected virtual void LoadProcedureTableSchema(DataConnection dataConnection, GetSchemaOptions options, ProcedureSchema procedure, string commandText, List<TableSchema> tables)
Parameters
dataConnection
DataConnectionoptions
GetSchemaOptionsprocedure
ProcedureSchemacommandText
stringtables
List<TableSchema>
ProcessSchema(DatabaseSchema, GetSchemaOptions)
protected virtual DatabaseSchema ProcessSchema(DatabaseSchema databaseSchema, GetSchemaOptions schemaOptions)
Parameters
databaseSchema
DatabaseSchemaschemaOptions
GetSchemaOptions
Returns
ToTypeName(Type?, bool)
public static string ToTypeName(Type? type, bool isNullable)
Parameters
Returns
ToValidName(string)
public static string ToValidName(string name)
Parameters
name
string