Skip to main content

OrmLiteConnectionFactory

Allow for mocking and unit testing by providing non-disposing connection factory with injectable IDbCommand and IDbTransaction proxies

Assembly: ServiceStack.OrmLite.dll
View Source
Declaration
public class OrmLiteConnectionFactory : object, IDbConnectionFactoryExtended, IDbConnectionFactory

Properties

DialectProvider

View Source
Declaration
public IOrmLiteDialectProvider DialectProvider { get; set; }

ConnectionString

View Source
Declaration
public string ConnectionString { get; set; }

AutoDisposeConnection

View Source
Declaration
public bool AutoDisposeConnection { get; set; }

ConnectionFilter

View Source
Declaration
public Func<IDbConnection, IDbConnection> ConnectionFilter { get; set; }

AlwaysReturnCommand

Force the IDbConnection to always return this IDbCommand

View Source
Declaration
public IDbCommand AlwaysReturnCommand { get; set; }

AlwaysReturnTransaction

Force the IDbConnection to always return this IDbTransaction

View Source
Declaration
public IDbTransaction AlwaysReturnTransaction { get; set; }

OnDispose

View Source
Declaration
public Action<OrmLiteConnection> OnDispose { get; set; }

DialectProviders

View Source
Declaration
public static Dictionary<string, IOrmLiteDialectProvider> DialectProviders { get; }

NamedConnections

View Source
Declaration
public static Dictionary<string, OrmLiteConnectionFactory> NamedConnections { get; }

Methods

CreateDbConnection()

View Source
Declaration
public virtual IDbConnection CreateDbConnection()
Returns

IDbConnection

CreateDbConnection(String)

View Source
Declaration
public static IDbConnection CreateDbConnection(string namedConnection)
Returns

IDbConnection

Parameters
TypeName
System.StringnamedConnection

OpenDbConnection()

View Source
Declaration
public virtual IDbConnection OpenDbConnection()
Returns

IDbConnection

OpenDbConnectionAsync(CancellationToken)

View Source
Declaration
public virtual async Task<IDbConnection> OpenDbConnectionAsync(CancellationToken token = null)
Returns

Task<IDbConnection>

Parameters
TypeName
CancellationTokentoken

OpenDbConnectionAsync(String, CancellationToken)

View Source
Declaration
public virtual async Task<IDbConnection> OpenDbConnectionAsync(string namedConnection, CancellationToken token = null)
Returns

Task<IDbConnection>

Parameters
TypeName
System.StringnamedConnection
CancellationTokentoken

OpenDbConnectionString(String)

View Source
Declaration
public virtual IDbConnection OpenDbConnectionString(string connectionString)
Returns

IDbConnection

Parameters
TypeName
System.StringconnectionString

OpenDbConnectionStringAsync(String, CancellationToken)

View Source
Declaration
public virtual async Task<IDbConnection> OpenDbConnectionStringAsync(string connectionString, CancellationToken token = null)
Returns

Task<IDbConnection>

Parameters
TypeName
System.StringconnectionString
CancellationTokentoken

OpenDbConnectionString(String, String)

View Source
Declaration
public virtual IDbConnection OpenDbConnectionString(string connectionString, string providerName)
Returns

IDbConnection

Parameters
TypeName
System.StringconnectionString
System.StringproviderName

OpenDbConnectionStringAsync(String, String, CancellationToken)

View Source
Declaration
public virtual async Task<IDbConnection> OpenDbConnectionStringAsync(string connectionString, string providerName, CancellationToken token = null)
Returns

Task<IDbConnection>

Parameters
TypeName
System.StringconnectionString
System.StringproviderName
CancellationTokentoken

OpenDbConnection(String)

View Source
Declaration
public virtual IDbConnection OpenDbConnection(string namedConnection)
Returns

IDbConnection

Parameters
TypeName
System.StringnamedConnection

RegisterDialectProvider(String, IOrmLiteDialectProvider)

View Source
Declaration
public virtual void RegisterDialectProvider(string providerName, IOrmLiteDialectProvider dialectProvider)
Parameters
TypeName
System.StringproviderName
ServiceStack.OrmLite.IOrmLiteDialectProviderdialectProvider

RegisterConnection(String, String, IOrmLiteDialectProvider)

View Source
Declaration
public virtual void RegisterConnection(string namedConnection, string connectionString, IOrmLiteDialectProvider dialectProvider)
Parameters
TypeName
System.StringnamedConnection
System.StringconnectionString
ServiceStack.OrmLite.IOrmLiteDialectProviderdialectProvider

RegisterConnection(String, OrmLiteConnectionFactory)

View Source
Declaration
public virtual void RegisterConnection(string namedConnection, OrmLiteConnectionFactory connectionFactory)
Parameters
TypeName
System.StringnamedConnection
ServiceStack.OrmLite.OrmLiteConnectionFactoryconnectionFactory

Implements