Interface IDatabaseConnector
Provides an interface to connecto to a database server.
Namespace: Paradigm.ORM.Data.Database
Assembly: Paradigm.ORM.Data.dll
Syntax
public interface IDatabaseConnector : IDisposable
Properties
| Improve this Doc View SourceConfiguration
Gets the database configuration.
Declaration
IDatabaseConfiguration Configuration { get; }
Property Value
Type | Description |
---|---|
IDatabaseConfiguration | The configuration. |
ConnectionTimeout
Gets the time to wait while trying to establish a connection before terminating the attempt and generating an error.
Declaration
int ConnectionTimeout { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The time (in seconds) to wait for a connection to open. The default value is 15 seconds. |
Methods
| Improve this Doc View SourceClose()
Closes a previously opened connection to a database.
Declaration
void Close()
CloseAsync()
Closes a previously opened connection to a database.
Declaration
Task CloseAsync()
Returns
Type | Description |
---|---|
Task |
CreateCommand()
Creates a new database command.
Declaration
IDatabaseCommand CreateCommand()
Returns
Type | Description |
---|---|
IDatabaseCommand | A new command. |
CreateTransaction()
Creates a new database transaction.
Declaration
IDatabaseTransaction CreateTransaction()
Returns
Type | Description |
---|---|
IDatabaseTransaction | A new transaction |
CreateTransaction(IsolationLevel)
Creates a new database transaction.
Declaration
IDatabaseTransaction CreateTransaction(IsolationLevel isolationLevel)
Parameters
Type | Name | Description |
---|---|---|
IsolationLevel | isolationLevel | Specifies the transaction isolation level. |
Returns
Type | Description |
---|---|
IDatabaseTransaction | A new transaction. |
GetCommandBuilderFactory()
Gets a command builder factory.
Declaration
ICommandBuilderFactory GetCommandBuilderFactory()
Returns
Type | Description |
---|---|
ICommandBuilderFactory | The command builder factory related to this database type. |
Remarks
The command builder factory creates command builders for standard crud actions over a given data type.
GetCommandFormatProvider()
Get a command text format provider.
Declaration
ICommandFormatProvider GetCommandFormatProvider()
Returns
Type | Description |
---|---|
ICommandFormatProvider | The command formatted realted to this database type. |
Remarks
The command formatter gives basic functionality to format sql queries for each database type.
GetDbStringTypeConverter()
Gets a string type converter.
Declaration
IDbStringTypeConverter GetDbStringTypeConverter()
Returns
Type | Description |
---|---|
IDbStringTypeConverter | A database type converter. |
Remarks
This converter can convert back and forth from a database type in string format, to a .NET type.
Examples
For the string "int" the converter will return
GetDbTypeValueRangeProvider()
Gets the database type size provider.
Declaration
IDbTypeValueRangeProvider GetDbTypeValueRangeProvider()
Returns
Type | Description |
---|---|
IDbTypeValueRangeProvider |
Remarks
A database type size provider retrieves minimum and maximum values for regular sql types like tinyint, smallint, int, etc.
GetSchemaProvider()
Gets a database schema provider.
Declaration
ISchemaProvider GetSchemaProvider()
Returns
Type | Description |
---|---|
ISchemaProvider | A schema provider related to this database connection. |
Remarks
The schema provider, allows to retrieve schema information about database objects like tables, views, stored procedures, etc.
GetValueConverter()
Gets the value converter.
Declaration
IValueConverter GetValueConverter()
Returns
Type | Description |
---|---|
IValueConverter | A value converter. |
Remarks
This converter can convert from database objects to specific .net types.
Initialize(String)
Initializes the connection against the database.
Declaration
void Initialize(string connectionString = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | connectionString | A connection string containing information to connect to a given database. |
IsOpen()
Indicates if the connection is currently opened.
Declaration
bool IsOpen()
Returns
Type | Description |
---|---|
System.Boolean | True if the connection is opened, false otherwise. |
Open()
Opens the conection to a database.
Declaration
void Open()
OpenAsync()
Opens the conection to a database.
Declaration
Task OpenAsync()
Returns
Type | Description |
---|---|
Task |