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
Type | Name |
---|---|
System.String | namedConnection |
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
Type | Name |
---|---|
CancellationToken | token |
OpenDbConnectionAsync(String, CancellationToken)
View Source
Declaration
public virtual async Task<IDbConnection> OpenDbConnectionAsync(string namedConnection, CancellationToken token = null)
Returns
Task<IDbConnection>
Parameters
Type | Name |
---|---|
System.String | namedConnection |
CancellationToken | token |
OpenDbConnectionString(String)
View Source
Declaration
public virtual IDbConnection OpenDbConnectionString(string connectionString)
Returns
IDbConnection
Parameters
Type | Name |
---|---|
System.String | connectionString |
OpenDbConnectionStringAsync(String, CancellationToken)
View Source
Declaration
public virtual async Task<IDbConnection> OpenDbConnectionStringAsync(string connectionString, CancellationToken token = null)
Returns
Task<IDbConnection>
Parameters
Type | Name |
---|---|
System.String | connectionString |
CancellationToken | token |
OpenDbConnectionString(String, String)
View Source
Declaration
public virtual IDbConnection OpenDbConnectionString(string connectionString, string providerName)
Returns
IDbConnection
Parameters
Type | Name |
---|---|
System.String | connectionString |
System.String | providerName |
OpenDbConnectionStringAsync(String, String, CancellationToken)
View Source
Declaration
public virtual async Task<IDbConnection> OpenDbConnectionStringAsync(string connectionString, string providerName, CancellationToken token = null)
Returns
Task<IDbConnection>
Parameters
Type | Name |
---|---|
System.String | connectionString |
System.String | providerName |
CancellationToken | token |
OpenDbConnection(String)
View Source
Declaration
public virtual IDbConnection OpenDbConnection(string namedConnection)
Returns
IDbConnection
Parameters
Type | Name |
---|---|
System.String | namedConnection |
RegisterDialectProvider(String, IOrmLiteDialectProvider)
View Source
Declaration
public virtual void RegisterDialectProvider(string providerName, IOrmLiteDialectProvider dialectProvider)
Parameters
Type | Name |
---|---|
System.String | providerName |
ServiceStack.OrmLite.IOrmLiteDialectProvider | dialectProvider |
RegisterConnection(String, String, IOrmLiteDialectProvider)
View Source
Declaration
public virtual void RegisterConnection(string namedConnection, string connectionString, IOrmLiteDialectProvider dialectProvider)
Parameters
Type | Name |
---|---|
System.String | namedConnection |
System.String | connectionString |
ServiceStack.OrmLite.IOrmLiteDialectProvider | dialectProvider |
RegisterConnection(String, OrmLiteConnectionFactory)
View Source
Declaration
public virtual void RegisterConnection(string namedConnection, OrmLiteConnectionFactory connectionFactory)
Parameters
Type | Name |
---|---|
System.String | namedConnection |
ServiceStack.OrmLite.OrmLiteConnectionFactory | connectionFactory |