Class MySqlDatabaseConnector
Provides a connection to a MySql Server database.
Inheritance
Namespace: Paradigm.ORM.Data.MySql
Assembly: Paradigm.ORM.Data.MySql.dll
Syntax
public class MySqlDatabaseConnector : object, IDatabaseConnector, IDisposable
Constructors
| Improve this Doc View SourceMySqlDatabaseConnector()
Initializes a new instance of the MySqlDatabaseConnector class.
Declaration
public MySqlDatabaseConnector()
MySqlDatabaseConnector(String)
Initializes a new instance of the MySqlDatabaseConnector class.
Declaration
public MySqlDatabaseConnector(string connectionString)
Parameters
Type | Name | Description |
---|---|---|
System.String | connectionString | The connection string. |
Properties
| Improve this Doc View SourceConfiguration
Gets the database configuration.
Declaration
public 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
public 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
public void Close()
CloseAsync()
Closes a previously opened connection to a database.
Declaration
public Task CloseAsync()
Returns
Type | Description |
---|---|
Task |
CreateCommand()
Creates a new database command.
Declaration
public IDatabaseCommand CreateCommand()
Returns
Type | Description |
---|---|
IDatabaseCommand | A new Paradigm.ORM.Data.MySql.MySqlDatabaseCommand. |
CreateTransaction()
Creates a new database transaction.
Declaration
public IDatabaseTransaction CreateTransaction()
Returns
Type | Description |
---|---|
IDatabaseTransaction | A new Paradigm.ORM.Data.MySql.MySqlDatabaseTransaction. |
CreateTransaction(IsolationLevel)
Creates a new database transaction.
Declaration
public IDatabaseTransaction CreateTransaction(IsolationLevel isolationLevel)
Parameters
Type | Name | Description |
---|---|---|
IsolationLevel | isolationLevel | Specifies the transaction isolation level. |
Returns
Type | Description |
---|---|
IDatabaseTransaction | A new Paradigm.ORM.Data.MySql.MySqlDatabaseTransaction. |
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
GetCommandBuilderFactory()
Gets a command builder factory.
Declaration
public 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
public 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
public 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
public 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()
Get a database schema provider.
Declaration
public 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
public 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
public 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
public bool IsOpen()
Returns
Type | Description |
---|---|
System.Boolean | True if the connection is opened, false otherwise. |
Open()
Opens the conection to a database.
Declaration
public void Open()
OpenAsync()
Opens the conection to a database.
Declaration
public Task OpenAsync()
Returns
Type | Description |
---|---|
Task |