Show / Hide Table of Contents

    Class DatabaseSchemaLoader

    Helper class for simple loading of database schemas. It contains inner list of different loaders, so it can be used for loading database schema for different databases. Fresh database schema is loaded for every request, it means, loaded schemas are not cached.

    Inheritance
    System.Object
    DatabaseSchemaLoader
    Implements
    IDatabaseSchemaLoader
    Namespace: Kros.Data.Schema
    Assembly: Kros.Utils.dll
    Syntax
    public class DatabaseSchemaLoader : IDatabaseSchemaLoader
    Remarks

    Class is a wrapper for loaders for different databases and so it allows loading of database schema for any known database type. More loaders can be added by AddSchemaLoader(IDatabaseSchemaLoader)

    The class is intended for static use, using property Default. By default, it contains loader for Microsoft SQL Server (SqlServerSchemaLoader.

    Examples

    Properties

    Default

    Instance of DatabaseSchemaLoader intended for general use. It contains loader for Microsoft SQL Server by default (SqlServerSchemaLoader).

    Declaration
    public static DatabaseSchemaLoader Default { get; }
    Property Value
    Type Description
    DatabaseSchemaLoader

    Methods

    AddSchemaLoader(IDatabaseSchemaLoader)

    Adds loader to the list of loaders.

    Declaration
    public void AddSchemaLoader(IDatabaseSchemaLoader loader)
    Parameters
    Type Name Description
    IDatabaseSchemaLoader loader

    Specific database schema loader.

    Exceptions
    Type Condition
    System.ArgumentNullException

    Value of loader is null.

    ClearSchemaLoaders()

    Removes all loaders in the list.

    Declaration
    public void ClearSchemaLoaders()

    LoadSchema(Object)

    Declaration
    public DatabaseSchema LoadSchema(object connection)
    Parameters
    Type Name Description
    System.Object connection
    Returns
    Type Description
    DatabaseSchema
    Exceptions
    Type Condition
    System.ArgumentNullException

    Value of connection is null.

    System.ArgumentException

    Loader for connection type specified by connection does not exist.

    LoadTableSchema(Object, String)

    Declaration
    public TableSchema LoadTableSchema(object connection, string tableName)
    Parameters
    Type Name Description
    System.Object connection
    System.String tableName
    Returns
    Type Description
    TableSchema
    Exceptions
    Type Condition
    System.ArgumentNullException

    Value of any parameter is null.

    System.ArgumentException

    RemoveSchemaLoader(IDatabaseSchemaLoader)

    Removes loader from the list of loaders.

    Declaration
    public void RemoveSchemaLoader(IDatabaseSchemaLoader loader)
    Parameters
    Type Name Description
    IDatabaseSchemaLoader loader

    Specific database schema loader to be removed from the list.

    SupportsConnectionType(Object)

    Checks, if database schema from connection can be loaded.

    Declaration
    public bool SupportsConnectionType(object connection)
    Parameters
    Type Name Description
    System.Object connection

    Database connection.

    Returns
    Type Description
    System.Boolean

    true if loading schema for connection is supported, false otherwise. Internal list of loader is checked and method returns true if any of the loaders can load schema from connection.

    Implements

    IDatabaseSchemaLoader
    Back to top KROS a.s.