Class DapperExtensions
Inheritance
System.Object
DapperExtensions
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Assembly: DapperExtensions.StrongName.dll
Syntax
public static class DapperExtensions
Properties
|
Improve this Doc
View Source
DefaultMapper
Declaration
public static Type DefaultMapper { get; set; }
Property Value
Type |
Description |
System.Type |
|
|
Improve this Doc
View Source
InstanceFactory
Get or sets the Dapper Extensions Implementation Factory.
Declaration
public static Func<IDapperExtensionsConfiguration, IDapperImplementor> InstanceFactory { get; set; }
Property Value
|
Improve this Doc
View Source
SqlDialect
Declaration
public static ISqlDialect SqlDialect { get; set; }
Property Value
Methods
|
Improve this Doc
View Source
ClearCache()
Clears the ClassMappers for each type.
Declaration
public static void ClearCache()
|
Improve this Doc
View Source
Configure DapperExtensions extension methods.
Declaration
public static void Configure(IDapperExtensionsConfiguration configuration)
Parameters
|
Improve this Doc
View Source
Configure DapperExtensions extension methods.
Declaration
public static void Configure(Type defaultMapper, IList<Assembly> mappingAssemblies, ISqlDialect sqlDialect)
Parameters
Type |
Name |
Description |
System.Type |
defaultMapper |
|
System.Collections.Generic.IList<System.Reflection.Assembly> |
mappingAssemblies |
|
ISqlDialect |
sqlDialect |
|
|
Improve this Doc
View Source
Count<T>(DbConnection, Object, DbTransaction, Nullable<Int32>)
Executes a query using the specified predicate, returning an integer that represents the number of rows that match the query.
Declaration
public static int Count<T>(this DbConnection connection, object predicate, DbTransaction transaction = null, int? commandTimeout = null)
where T : class
Parameters
Type |
Name |
Description |
System.Data.Common.DbConnection |
connection |
|
System.Object |
predicate |
|
System.Data.Common.DbTransaction |
transaction |
|
System.Nullable<System.Int32> |
commandTimeout |
|
Returns
Type |
Description |
System.Int32 |
|
Type Parameters
|
Improve this Doc
View Source
Delete<T>(DbConnection, T, DbTransaction, Nullable<Int32>)
Executes a delete query for the specified entity.
Declaration
public static bool Delete<T>(this DbConnection connection, T entity, DbTransaction transaction = null, int? commandTimeout = null)
where T : class
Parameters
Type |
Name |
Description |
System.Data.Common.DbConnection |
connection |
|
T |
entity |
|
System.Data.Common.DbTransaction |
transaction |
|
System.Nullable<System.Int32> |
commandTimeout |
|
Returns
Type |
Description |
System.Boolean |
|
Type Parameters
|
Improve this Doc
View Source
Delete<T>(DbConnection, Object, DbTransaction, Nullable<Int32>)
Executes a delete query using the specified predicate.
Declaration
public static bool Delete<T>(this DbConnection connection, object predicate, DbTransaction transaction = null, int? commandTimeout = null)
where T : class
Parameters
Type |
Name |
Description |
System.Data.Common.DbConnection |
connection |
|
System.Object |
predicate |
|
System.Data.Common.DbTransaction |
transaction |
|
System.Nullable<System.Int32> |
commandTimeout |
|
Returns
Type |
Description |
System.Boolean |
|
Type Parameters
|
Improve this Doc
View Source
Get<T>(DbConnection, Object, DbTransaction, Nullable<Int32>)
Executes a query for the specified id, returning the data typed as per T
Declaration
public static T Get<T>(this DbConnection connection, dynamic id, DbTransaction transaction = null, int? commandTimeout = null)
where T : class
Parameters
Type |
Name |
Description |
System.Data.Common.DbConnection |
connection |
|
System.Object |
id |
|
System.Data.Common.DbTransaction |
transaction |
|
System.Nullable<System.Int32> |
commandTimeout |
|
Returns
Type Parameters
|
Improve this Doc
View Source
GetList<T>(DbConnection, Object, IList<ISort>, DbTransaction, Nullable<Int32>, Boolean)
Executes a select query using the specified predicate, returning an IEnumerable data typed as per T.
Declaration
public static IEnumerable<T> GetList<T>(this DbConnection connection, object predicate = null, IList<ISort> sort = null, DbTransaction transaction = null, int? commandTimeout = null, bool buffered = false)
where T : class
Parameters
Type |
Name |
Description |
System.Data.Common.DbConnection |
connection |
|
System.Object |
predicate |
|
System.Collections.Generic.IList<ISort> |
sort |
|
System.Data.Common.DbTransaction |
transaction |
|
System.Nullable<System.Int32> |
commandTimeout |
|
System.Boolean |
buffered |
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<T> |
|
Type Parameters
|
Improve this Doc
View Source
GetMap<T>()
Gets the appropriate mapper for the specified type T.
If the mapper for the type is not yet created, a new mapper is generated from the mapper type specifed by DefaultMapper.
Declaration
public static IClassMapper GetMap<T>()
where T : class
Returns
Type Parameters
|
Improve this Doc
View Source
GetMultiple(DbConnection, GetMultiplePredicate, DbTransaction, Nullable<Int32>)
Executes a select query for multiple objects, returning IMultipleResultReader for each predicate.
Declaration
public static IMultipleResultReader GetMultiple(this DbConnection connection, GetMultiplePredicate predicate, DbTransaction transaction = null, int? commandTimeout = null)
Parameters
Type |
Name |
Description |
System.Data.Common.DbConnection |
connection |
|
GetMultiplePredicate |
predicate |
|
System.Data.Common.DbTransaction |
transaction |
|
System.Nullable<System.Int32> |
commandTimeout |
|
Returns
|
Improve this Doc
View Source
GetNextGuid()
Declaration
public static Guid GetNextGuid()
Returns
Type |
Description |
System.Guid |
|
|
Improve this Doc
View Source
GetPage<T>(DbConnection, Object, IList<ISort>, Int32, Int32, DbTransaction, Nullable<Int32>, Boolean)
Executes a select query using the specified predicate, returning an IEnumerable data typed as per T.
Data returned is dependent upon the specified page and resultsPerPage.
Declaration
public static IEnumerable<T> GetPage<T>(this DbConnection connection, object predicate, IList<ISort> sort, int page, int resultsPerPage, DbTransaction transaction = null, int? commandTimeout = null, bool buffered = false)
where T : class
Parameters
Type |
Name |
Description |
System.Data.Common.DbConnection |
connection |
|
System.Object |
predicate |
|
System.Collections.Generic.IList<ISort> |
sort |
|
System.Int32 |
page |
|
System.Int32 |
resultsPerPage |
|
System.Data.Common.DbTransaction |
transaction |
|
System.Nullable<System.Int32> |
commandTimeout |
|
System.Boolean |
buffered |
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<T> |
|
Type Parameters
|
Improve this Doc
View Source
GetSet<T>(DbConnection, Object, IList<ISort>, Int32, Int32, DbTransaction, Nullable<Int32>, Boolean)
Executes a select query using the specified predicate, returning an IEnumerable data typed as per T.
Data returned is dependent upon the specified firstResult and maxResults.
Declaration
public static IEnumerable<T> GetSet<T>(this DbConnection connection, object predicate, IList<ISort> sort, int firstResult, int maxResults, DbTransaction transaction = null, int? commandTimeout = null, bool buffered = false)
where T : class
Parameters
Type |
Name |
Description |
System.Data.Common.DbConnection |
connection |
|
System.Object |
predicate |
|
System.Collections.Generic.IList<ISort> |
sort |
|
System.Int32 |
firstResult |
|
System.Int32 |
maxResults |
|
System.Data.Common.DbTransaction |
transaction |
|
System.Nullable<System.Int32> |
commandTimeout |
|
System.Boolean |
buffered |
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<T> |
|
Type Parameters
|
Improve this Doc
View Source
Insert<T>(DbConnection, T, DbTransaction, Nullable<Int32>)
Executes an insert query for the specified entity, returning the primary key.
If the entity has a single key, just the value is returned.
If the entity has a composite key, an IDictionary<string, object> is returned with the key values.
The key value for the entity will also be updated if the KeyType is a Guid or Identity.
Declaration
public static dynamic Insert<T>(this DbConnection connection, T entity, DbTransaction transaction = null, int? commandTimeout = null)
where T : class
Parameters
Type |
Name |
Description |
System.Data.Common.DbConnection |
connection |
|
T |
entity |
|
System.Data.Common.DbTransaction |
transaction |
|
System.Nullable<System.Int32> |
commandTimeout |
|
Returns
Type |
Description |
System.Object |
|
Type Parameters
|
Improve this Doc
View Source
Insert<T>(DbConnection, IEnumerable<T>, DbTransaction, Nullable<Int32>)
Executes an insert query for the specified entity.
Declaration
public static void Insert<T>(this DbConnection connection, IEnumerable<T> entities, DbTransaction transaction = null, int? commandTimeout = null)
where T : class
Parameters
Type |
Name |
Description |
System.Data.Common.DbConnection |
connection |
|
System.Collections.Generic.IEnumerable<T> |
entities |
|
System.Data.Common.DbTransaction |
transaction |
|
System.Nullable<System.Int32> |
commandTimeout |
|
Type Parameters
|
Improve this Doc
View Source
SetMappingAssemblies(IList<Assembly>)
Add other assemblies that Dapper Extensions will search if a mapping is not found in the same assembly of the POCO.
Declaration
public static void SetMappingAssemblies(IList<Assembly> assemblies)
Parameters
Type |
Name |
Description |
System.Collections.Generic.IList<System.Reflection.Assembly> |
assemblies |
|
|
Improve this Doc
View Source
Update<T>(DbConnection, T, DbTransaction, Nullable<Int32>)
Executes an update query for the specified entity.
Declaration
public static bool Update<T>(this DbConnection connection, T entity, DbTransaction transaction = null, int? commandTimeout = null)
where T : class
Parameters
Type |
Name |
Description |
System.Data.Common.DbConnection |
connection |
|
T |
entity |
|
System.Data.Common.DbTransaction |
transaction |
|
System.Nullable<System.Int32> |
commandTimeout |
|
Returns
Type |
Description |
System.Boolean |
|
Type Parameters