Table of Contents

Class DapperDataSource

Namespace
Savvyio.Extensions.Dapper
Assembly
Savvyio.Extensions.Dapper.dll

Provides a default implementation of the IDapperDataSource interface to support the actual I/O communication with a source of data using Dapper.

public class DapperDataSource : Disposable, IDapperDataSource, IDataSource, IDbConnection, IDisposable
Inheritance
DapperDataSource
Implements
Derived
Inherited Members

Constructors

DapperDataSource(DapperDataSourceOptions)

Initializes a new instance of the DapperDataSource class.

public DapperDataSource(DapperDataSourceOptions options)

Parameters

options DapperDataSourceOptions

The DapperDataSourceOptions used to configure this instance.

Exceptions

ArgumentNullException

options cannot be null.

ArgumentException

options are not in a valid state.

Properties

ConnectionString

Gets or sets the string used to open a database.

public string ConnectionString { get; set; }

Property Value

string

A string containing connection settings.

ConnectionTimeout

Gets the time to wait (in seconds) while trying to establish a connection before terminating the attempt and generating an error.

public int ConnectionTimeout { get; }

Property Value

int

The time (in seconds) to wait for a connection to open. The default value is 15 seconds.

Database

Gets the name of the current database or the database to be used after a connection is opened.

public string Database { get; }

Property Value

string

The name of the current database or the name of the database to be used once a connection is open. The default value is an empty string.

State

Gets the current state of the connection.

public ConnectionState State { get; }

Property Value

ConnectionState

One of the ConnectionState values.

Methods

BeginTransaction()

Begins a database transaction.

public IDbTransaction BeginTransaction()

Returns

IDbTransaction

An object representing the new transaction.

BeginTransaction(IsolationLevel)

Begins a database transaction.

public IDbTransaction BeginTransaction(IsolationLevel il)

Parameters

il IsolationLevel

One of the IsolationLevel values.

Returns

IDbTransaction

An object representing the new transaction.

ChangeDatabase(string)

Changes the current database for an open Connection object.

public void ChangeDatabase(string databaseName)

Parameters

databaseName string

The name of the database to use in place of the current database.

Close()

Closes the connection to the database.

public void Close()

CreateCommand()

Creates and returns a Command object associated with the connection.

public IDbCommand CreateCommand()

Returns

IDbCommand

A Command object associated with the connection.

OnDisposeManagedResources()

Called when this object is being disposed by either Dispose() or Dispose(bool) having disposing set to true and Disposed is false.

protected override void OnDisposeManagedResources()

Open()

Opens a database connection with the settings specified by the ConnectionString property of the provider-specific Connection object.

public void Open()

See Also