Class MsAccessSchemaLoader
The implementation of IDatabaseSchemaLoader<T> for Microsoft Access.
Inheritance
Namespace: Kros.Data.Schema.MsAccess
Assembly: Kros.Utils.MsAccess.dll
Syntax
public class MsAccessSchemaLoader : IDatabaseSchemaLoader<OleDbConnection>, IDatabaseSchemaLoader
Methods
GetDefaultValueString(String)
Adjusts the string rawDefaultValueString so column's default value can be obtained from it.
Declaration
protected virtual string GetDefaultValueString(string rawDefaultValueString)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | rawDefaultValueString | Default value string as it is stored in database. |
Returns
| Type | Description |
|---|---|
| System.String | Adjusted string - trimmed of unneeded characters. |
LoadSchema(OleDbConnection)
Loads database schema for connection.
Declaration
public DatabaseSchema LoadSchema(OleDbConnection connection)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Data.OleDb.OleDbConnection | connection | Database connection. |
Returns
| Type | Description |
|---|---|
| DatabaseSchema | Database schema. |
Remarks
Loading schema creates a new connection to database based on connection. If loading with
new connection fails (for example input connection is exclusive), schema is loaded using input
connection directly.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | Value of |
| System.ArgumentException | The connection |
LoadTableSchema(OleDbConnection, String)
Loads table schema for table tableName in database connection.
Declaration
public TableSchema LoadTableSchema(OleDbConnection connection, string tableName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Data.OleDb.OleDbConnection | connection | Database connection. |
| System.String | tableName | Table name. |
Returns
| Type | Description |
|---|---|
| TableSchema | Table schema, or value null if specified table does not exist. |
Remarks
Loading schema creates a new connection to database based on connection. If loading with
new connection fails (for example input connection is exclusive), schema is loaded using input
connection directly.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | |
| System.ArgumentException | Value of |
OnParseDefaultValue(MsAccessParseDefaultValueEventArgs)
Raises the ParseDefaultValue event with arguments e.
Declaration
protected virtual void OnParseDefaultValue(MsAccessParseDefaultValueEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| MsAccessParseDefaultValueEventArgs | e | Arguments for the event. |
SupportsConnectionType(OleDbConnection)
Checks if it is poosible to load database schema for connection.
Declaration
public bool SupportsConnectionType(OleDbConnection connection)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Data.OleDb.OleDbConnection | connection | Database connection. |
Returns
| Type | Description |
|---|---|
| System.Boolean | false if value of |
Events
ParseDefaultValue
Event raised while parsing default value of a column. It is possible to use custom parsing logic in the event handler.
Declaration
public event EventHandler<MsAccessParseDefaultValueEventArgs> ParseDefaultValue
Event Type
| Type | Description |
|---|---|
| System.EventHandler<MsAccessParseDefaultValueEventArgs> |
Remarks
When custom logic for parsing column's default value is used, the parsed value is set in DefaultValue property and Handled flag must be set to true.
Explicit Interface Implementations
IDatabaseSchemaLoader.LoadSchema(Object)
Loads database schema for connection.
Declaration
DatabaseSchema IDatabaseSchemaLoader.LoadSchema(object connection)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | connection | Database connection. |
Returns
| Type | Description |
|---|---|
| DatabaseSchema | Database schema. |
Remarks
By default, schema is loaded using new connection to the database, based on connection.
But if connection is an exclusive connection, it is used directly.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | The value of |
| System.ArgumentException | The connection |
IDatabaseSchemaLoader.LoadTableSchema(Object, String)
Loads table schema for table tableName in database connection.
Declaration
TableSchema IDatabaseSchemaLoader.LoadTableSchema(object connection, string tableName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | connection | Database connection. |
| System.String | tableName | Table name. |
Returns
| Type | Description |
|---|---|
| TableSchema | Table schema, or value null if specified table does not exist. |
Remarks
By default, schema is loaded using new connection to the database, based on connection.
But if connection is an exclusive connection, it is used directly.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | The value of |
| System.ArgumentException |
IDatabaseSchemaLoader.SupportsConnectionType(Object)
Declaration
bool IDatabaseSchemaLoader.SupportsConnectionType(object connection)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | connection |
Returns
| Type | Description |
|---|---|
| System.Boolean |