Skip to main content

OrmLiteWriteApiAsync

Assembly: ServiceStack.OrmLite.dll
View Source
Declaration
public static class OrmLiteWriteApiAsync : object

Methods

ExecuteSqlAsync(IDbConnection, String, CancellationToken)

Execute any arbitrary raw SQL.

View Source
Declaration
public static Task<int> ExecuteSqlAsync(this IDbConnection dbConn, string sql, CancellationToken token = null)
Returns

Task<System.Int32>: number of rows affected

Parameters
TypeName
IDbConnectiondbConn
System.Stringsql
CancellationTokentoken

ExecuteSqlAsync(IDbConnection, String, Object, CancellationToken)

Execute any arbitrary raw SQL with db params.

View Source
Declaration
public static Task<int> ExecuteSqlAsync(this IDbConnection dbConn, string sql, object dbParams, CancellationToken token = null)
Returns

Task<System.Int32>: number of rows affected

Parameters
TypeName
IDbConnectiondbConn
System.Stringsql
System.ObjectdbParams
CancellationTokentoken

InsertAsync<T>(IDbConnection, T, Boolean, Boolean, CancellationToken)

Insert 1 POCO, use selectIdentity to retrieve the last insert AutoIncrement id (if any). E.g: <p>var id = db.Insert(new Person { Id = 1, FirstName = "Jimi }, selectIdentity:true)</p>

View Source
Declaration
public static Task<long> InsertAsync<T>(this IDbConnection dbConn, T obj, bool selectIdentity = false, bool enableIdentityInsert = false, CancellationToken token = null)
Returns

Task<System.Int64>

Parameters
TypeName
IDbConnectiondbConn
<T>obj
System.BooleanselectIdentity
System.BooleanenableIdentityInsert
CancellationTokentoken
Type Parameters
  • T

InsertAsync<T>(IDbConnection, T, Action<IDbCommand>, Boolean, Boolean, CancellationToken)

Insert 1 POCO, use selectIdentity to retrieve the last insert AutoIncrement id (if any). E.g: <p>var id = db.Insert(new Person { Id = 1, FirstName = "Jimi }, selectIdentity:true)</p>

View Source
Declaration
public static Task<long> InsertAsync<T>(this IDbConnection dbConn, T obj, Action<IDbCommand> commandFilter, bool selectIdentity = false, bool enableIdentityInsert = false, CancellationToken token = null)
Returns

Task<System.Int64>

Parameters
TypeName
IDbConnectiondbConn
<T>obj
Action<IDbCommand>commandFilter
System.BooleanselectIdentity
System.BooleanenableIdentityInsert
CancellationTokentoken
Type Parameters
  • T

InsertAsync<T>(IDbConnection, Dictionary<String, Object>, Boolean, CancellationToken)

Insert 1 POCO, use selectIdentity to retrieve the last insert AutoIncrement id (if any). E.g: <p>var id = db.Insert(new Dictionary<string,object> { ["Id"] = 1, ["FirstName"] = "Jimi }, selectIdentity:true)</p>

View Source
Declaration
public static Task<long> InsertAsync<T>(this IDbConnection dbConn, Dictionary<string, object> obj, bool selectIdentity = false, CancellationToken token = null)
Returns

Task<System.Int64>

Parameters
TypeName
IDbConnectiondbConn
Dictionary<System.String,System.Object>obj
System.BooleanselectIdentity
CancellationTokentoken
Type Parameters
  • T

InsertAsync<T>(IDbConnection, Action<IDbCommand>, Dictionary<String, Object>, Boolean, CancellationToken)

Insert 1 POCO, use selectIdentity to retrieve the last insert AutoIncrement id (if any). E.g: <p>var id = db.Insert(new Dictionary<string,object> { ["Id"] = 1, ["FirstName"] = "Jimi }, dbCmd => applyFilter(dbCmd))</p>

View Source
Declaration
public static Task<long> InsertAsync<T>(this IDbConnection dbConn, Action<IDbCommand> commandFilter, Dictionary<string, object> obj, bool selectIdentity = false, CancellationToken token = null)
Returns

Task<System.Int64>

Parameters
TypeName
IDbConnectiondbConn
Action<IDbCommand>commandFilter
Dictionary<System.String,System.Object>obj
System.BooleanselectIdentity
CancellationTokentoken
Type Parameters
  • T

InsertAsync<T>(IDbConnection, CancellationToken, T[])

Insert 1 or more POCOs in a transaction. E.g: <p>db.InsertAsync(new Person { Id = 1, FirstName = "Tupac", LastName = "Shakur", Age = 25 },</p> <p> new Person { Id = 2, FirstName = "Biggie", LastName = "Smalls", Age = 24 })</p>

View Source
Declaration
public static Task InsertAsync<T>(this IDbConnection dbConn, CancellationToken token, params T[] objs)
Returns

Task

Parameters
TypeName
IDbConnectiondbConn
CancellationTokentoken
<T>[]objs
Type Parameters
  • T

InsertAsync<T>(IDbConnection, T[])

View Source
Declaration
public static Task InsertAsync<T>(this IDbConnection dbConn, params T[] objs)
Returns

Task

Parameters
TypeName
IDbConnectiondbConn
<T>[]objs
Type Parameters
  • T

InsertAsync<T>(IDbConnection, Action<IDbCommand>, CancellationToken, T[])

Insert 1 or more POCOs in a transaction and modify populated IDbCommand with a commandFilter. E.g: <p>db.InsertAsync(dbCmd => applyFilter(dbCmd), token, </p> <p> new Person { Id = 1, FirstName = "Tupac", LastName = "Shakur", Age = 25 },</p> <p> new Person { Id = 2, FirstName = "Biggie", LastName = "Smalls", Age = 24 })</p>

View Source
Declaration
public static Task InsertAsync<T>(this IDbConnection dbConn, Action<IDbCommand> commandFilter, CancellationToken token, params T[] objs)
Returns

Task

Parameters
TypeName
IDbConnectiondbConn
Action<IDbCommand>commandFilter
CancellationTokentoken
<T>[]objs
Type Parameters
  • T

InsertUsingDefaultsAsync<T>(IDbConnection, T[], CancellationToken)

Insert 1 or more POCOs in a transaction using Table default values when defined. E.g: <p>db.InsertUsingDefaultsAsync(new Person { FirstName = "Tupac", LastName = "Shakur" },</p> <p> new Person { FirstName = "Biggie", LastName = "Smalls" })</p>

View Source
Declaration
public static Task InsertUsingDefaultsAsync<T>(this IDbConnection dbConn, T[] objs, CancellationToken token = null)
Returns

Task

Parameters
TypeName
IDbConnectiondbConn
<T>[]objs
CancellationTokentoken
Type Parameters
  • T

InsertIntoSelectAsync<T>(IDbConnection, ISqlExpression, CancellationToken)

Insert results from SELECT SqlExpression, use selectIdentity to retrieve the last insert AutoIncrement id (if any). E.g: <p>db.InsertIntoSelectAsync<Contact>(db.From<Person>().Select(x => new { x.Id, Surname == x.LastName }))</p>

View Source
Declaration
public static Task<long> InsertIntoSelectAsync<T>(this IDbConnection dbConn, ISqlExpression query, CancellationToken token = null)
Returns

Task<System.Int64>

Parameters
TypeName
IDbConnectiondbConn
ServiceStack.OrmLite.ISqlExpressionquery
CancellationTokentoken
Type Parameters
  • T

InsertIntoSelectAsync<T>(IDbConnection, ISqlExpression, Action<IDbCommand>, CancellationToken)

Insert results from SELECT SqlExpression, use selectIdentity to retrieve the last insert AutoIncrement id (if any). E.g: <p>db.InsertIntoSelectAsync<Contact>(db.From<Person>().Select(x => new { x.Id, Surname == x.LastName }))</p>

View Source
Declaration
public static Task<long> InsertIntoSelectAsync<T>(this IDbConnection dbConn, ISqlExpression query, Action<IDbCommand> commandFilter, CancellationToken token = null)
Returns

Task<System.Int64>

Parameters
TypeName
IDbConnectiondbConn
ServiceStack.OrmLite.ISqlExpressionquery
Action<IDbCommand>commandFilter
CancellationTokentoken
Type Parameters
  • T

InsertAllAsync<T>(IDbConnection, IEnumerable<T>, CancellationToken)

Insert a collection of POCOs in a transaction. E.g: <p>db.InsertAllAsync(new[] { new Person { Id = 9, FirstName = "Biggie", LastName = "Smalls", Age = 24 } })</p>

View Source
Declaration
public static Task InsertAllAsync<T>(this IDbConnection dbConn, IEnumerable<T> objs, CancellationToken token = null)
Returns

Task

Parameters
TypeName
IDbConnectiondbConn
IEnumerable<<T>>objs
CancellationTokentoken
Type Parameters
  • T

InsertAllAsync<T>(IDbConnection, IEnumerable<T>, Action<IDbCommand>, CancellationToken)

Insert a collection of POCOs in a transaction and modify populated IDbCommand with a commandFilter. E.g: <p>db.InsertAllAsync(new[] { new Person { Id = 9, FirstName = "Biggie", LastName = "Smalls", Age = 24 } },</p> <p> dbCmd => applyFilter(dbCmd))</p>

View Source
Declaration
public static Task InsertAllAsync<T>(this IDbConnection dbConn, IEnumerable<T> objs, Action<IDbCommand> commandFilter, CancellationToken token = null)
Returns

Task

Parameters
TypeName
IDbConnectiondbConn
IEnumerable<<T>>objs
Action<IDbCommand>commandFilter
CancellationTokentoken
Type Parameters
  • T

UpdateAsync<T>(IDbConnection, T, Action<IDbCommand>, CancellationToken)

Updates 1 POCO. All fields are updated except for the PrimaryKey which is used as the identity selector. E.g: <p>db.Update(new Person { Id = 1, FirstName = "Jimi", LastName = "Hendrix", Age = 27 })</p>

View Source
Declaration
public static Task<int> UpdateAsync<T>(this IDbConnection dbConn, T obj, Action<IDbCommand> commandFilter = null, CancellationToken token = null)
Returns

Task<System.Int32>

Parameters
TypeName
IDbConnectiondbConn
<T>obj
Action<IDbCommand>commandFilter
CancellationTokentoken
Type Parameters
  • T

UpdateAsync<T>(IDbConnection, Dictionary<String, Object>, Action<IDbCommand>, CancellationToken)

Updates 1 POCO. All fields are updated except for the PrimaryKey which is used as the identity selector. E.g: <p>db.Update(new Dictionary<string,object> { ["Id"] = 1, ["FirstName"] = "Jimi", ["Age"] = 27 })</p>

View Source
Declaration
public static Task<int> UpdateAsync<T>(this IDbConnection dbConn, Dictionary<string, object> obj, Action<IDbCommand> commandFilter = null, CancellationToken token = null)
Returns

Task<System.Int32>

Parameters
TypeName
IDbConnectiondbConn
Dictionary<System.String,System.Object>obj
Action<IDbCommand>commandFilter
CancellationTokentoken
Type Parameters
  • T

UpdateAsync<T>(IDbConnection, CancellationToken, T[])

Updates 1 or more POCOs in a transaction. E.g: <p>db.Update(new Person { Id = 1, FirstName = "Tupac", LastName = "Shakur", Age = 25 },</p> <p>new Person { Id = 2, FirstName = "Biggie", LastName = "Smalls", Age = 24 })</p>

View Source
Declaration
public static Task<int> UpdateAsync<T>(this IDbConnection dbConn, CancellationToken token, params T[] objs)
Returns

Task<System.Int32>

Parameters
TypeName
IDbConnectiondbConn
CancellationTokentoken
<T>[]objs
Type Parameters
  • T

UpdateAsync<T>(IDbConnection, T[])

View Source
Declaration
public static Task<int> UpdateAsync<T>(this IDbConnection dbConn, params T[] objs)
Returns

Task<System.Int32>

Parameters
TypeName
IDbConnectiondbConn
<T>[]objs
Type Parameters
  • T

UpdateAsync<T>(IDbConnection, Action<IDbCommand>, CancellationToken, T[])

View Source
Declaration
public static Task<int> UpdateAsync<T>(this IDbConnection dbConn, Action<IDbCommand> commandFilter, CancellationToken token, params T[] objs)
Returns

Task<System.Int32>

Parameters
TypeName
IDbConnectiondbConn
Action<IDbCommand>commandFilter
CancellationTokentoken
<T>[]objs
Type Parameters
  • T

UpdateAsync<T>(IDbConnection, Action<IDbCommand>, T[])

View Source
Declaration
public static Task<int> UpdateAsync<T>(this IDbConnection dbConn, Action<IDbCommand> commandFilter, params T[] objs)
Returns

Task<System.Int32>

Parameters
TypeName
IDbConnectiondbConn
Action<IDbCommand>commandFilter
<T>[]objs
Type Parameters
  • T

UpdateAllAsync<T>(IDbConnection, IEnumerable<T>, Action<IDbCommand>, CancellationToken)

Updates 1 or more POCOs in a transaction. E.g: <p>db.UpdateAllAsync(new[] { new Person { Id = 1, FirstName = "Jimi", LastName = "Hendrix", Age = 27 } })</p>

View Source
Declaration
public static Task<int> UpdateAllAsync<T>(this IDbConnection dbConn, IEnumerable<T> objs, Action<IDbCommand> commandFilter = null, CancellationToken token = null)
Returns

Task<System.Int32>

Parameters
TypeName
IDbConnectiondbConn
IEnumerable<<T>>objs
Action<IDbCommand>commandFilter
CancellationTokentoken
Type Parameters
  • T

DeleteAsync<T>(IDbConnection, Object, Action<IDbCommand>, CancellationToken)

Delete rows using an anonymous type filter. E.g: <p>db.DeleteAsync<Person>(new { FirstName = "Jimi", Age = 27 })</p>

View Source
Declaration
public static Task<int> DeleteAsync<T>(this IDbConnection dbConn, object anonFilter, Action<IDbCommand> commandFilter = null, CancellationToken token = null)
Returns

Task<System.Int32>: number of rows deleted

Parameters
TypeName
IDbConnectiondbConn
System.ObjectanonFilter
Action<IDbCommand>commandFilter
CancellationTokentoken
Type Parameters
  • T

DeleteAsync<T>(IDbConnection, Dictionary<String, Object>, Action<IDbCommand>, CancellationToken)

Delete rows using an Object Dictionary filters. E.g: <p>db.DeleteAsync<Person>(new Dictionary<string,object> { ["FirstName"] = "Jimi", ["Age"] = 27 })</p>

View Source
Declaration
public static Task<int> DeleteAsync<T>(this IDbConnection dbConn, Dictionary<string, object> filters, Action<IDbCommand> commandFilter = null, CancellationToken token = null)
Returns

Task<System.Int32>: number of rows deleted

Parameters
TypeName
IDbConnectiondbConn
Dictionary<System.String,System.Object>filters
Action<IDbCommand>commandFilter
CancellationTokentoken
Type Parameters
  • T

DeleteAsync<T>(IDbConnection, T, Action<IDbCommand>, CancellationToken)

Delete 1 row using all fields in the commandFilter. E.g: <p>db.DeleteAsync(new Person { Id = 1, FirstName = "Jimi", LastName = "Hendrix", Age = 27 })</p>

View Source
Declaration
public static Task<int> DeleteAsync<T>(this IDbConnection dbConn, T allFieldsFilter, Action<IDbCommand> commandFilter = null, CancellationToken token = null)
Returns

Task<System.Int32>: number of rows deleted

Parameters
TypeName
IDbConnectiondbConn
<T>allFieldsFilter
Action<IDbCommand>commandFilter
CancellationTokentoken
Type Parameters
  • T

DeleteAsync<T>(IDbConnection, Action<IDbCommand>, CancellationToken, T[])

Delete 1 or more rows in a transaction using all fields in the commandFilter. E.g: <p>db.DeleteAsync(new Person { Id = 1, FirstName = "Jimi", LastName = "Hendrix", Age = 27 })</p>

View Source
Declaration
public static Task<int> DeleteAsync<T>(this IDbConnection dbConn, Action<IDbCommand> commandFilter = null, CancellationToken token = null, params T[] allFieldsFilters)
Returns

Task<System.Int32>

Parameters
TypeName
IDbConnectiondbConn
Action<IDbCommand>commandFilter
CancellationTokentoken
<T>[]allFieldsFilters
Type Parameters
  • T

DeleteAsync<T>(IDbConnection, Action<IDbCommand>, T[])

View Source
Declaration
public static Task<int> DeleteAsync<T>(this IDbConnection dbConn, Action<IDbCommand> commandFilter = null, params T[] allFieldsFilters)
Returns

Task<System.Int32>

Parameters
TypeName
IDbConnectiondbConn
Action<IDbCommand>commandFilter
<T>[]allFieldsFilters
Type Parameters
  • T

DeleteNonDefaultsAsync<T>(IDbConnection, T, CancellationToken)

Delete 1 or more rows using only field with non-default values in the commandFilter. E.g: <p>db.DeleteNonDefaultsAsync(new Person { FirstName = "Jimi", Age = 27 })</p>

View Source
Declaration
public static Task<int> DeleteNonDefaultsAsync<T>(this IDbConnection dbConn, T nonDefaultsFilter, CancellationToken token = null)
Returns

Task<System.Int32>: number of rows deleted

Parameters
TypeName
IDbConnectiondbConn
<T>nonDefaultsFilter
CancellationTokentoken
Type Parameters
  • T

DeleteNonDefaultsAsync<T>(IDbConnection, CancellationToken, T[])

Delete 1 or more rows in a transaction using only field with non-default values in the commandFilter. E.g: <p>db.DeleteNonDefaultsAsync(new Person { FirstName = "Jimi", Age = 27 }, new Person { FirstName = "Janis", Age = 27 })</p>

View Source
Declaration
public static Task<int> DeleteNonDefaultsAsync<T>(this IDbConnection dbConn, CancellationToken token, params T[] nonDefaultsFilters)
Returns

Task<System.Int32>: number of rows deleted

Parameters
TypeName
IDbConnectiondbConn
CancellationTokentoken
<T>[]nonDefaultsFilters
Type Parameters
  • T

DeleteNonDefaultsAsync<T>(IDbConnection, T[])

View Source
Declaration
public static Task<int> DeleteNonDefaultsAsync<T>(this IDbConnection dbConn, params T[] nonDefaultsFilters)
Returns

Task<System.Int32>

Parameters
TypeName
IDbConnectiondbConn
<T>[]nonDefaultsFilters
Type Parameters
  • T

DeleteByIdAsync<T>(IDbConnection, Object, Action<IDbCommand>, CancellationToken)

Delete 1 row by the PrimaryKey. E.g: <p>db.DeleteByIdAsync<Person>(1)</p>

View Source
Declaration
public static Task<int> DeleteByIdAsync<T>(this IDbConnection dbConn, object id, Action<IDbCommand> commandFilter = null, CancellationToken token = null)
Returns

Task<System.Int32>: number of rows deleted

Parameters
TypeName
IDbConnectiondbConn
System.Objectid
Action<IDbCommand>commandFilter
CancellationTokentoken
Type Parameters
  • T

DeleteByIdAsync<T>(IDbConnection, Object, UInt64, Action<IDbCommand>, CancellationToken)

Delete 1 row by the PrimaryKey where the rowVersion matches the optimistic concurrency field. Will throw ServiceStack.Data.OptimisticConcurrencyException?text=RowModifiedException if the row does not exist or has a different row version. E.g: <p>db.DeleteByIdAsync<Person>(1)</p>

View Source
Declaration
public static Task DeleteByIdAsync<T>(this IDbConnection dbConn, object id, ulong rowVersion, Action<IDbCommand> commandFilter = null, CancellationToken token = null)
Returns

Task

Parameters
TypeName
IDbConnectiondbConn
System.Objectid
System.UInt64rowVersion
Action<IDbCommand>commandFilter
CancellationTokentoken
Type Parameters
  • T

DeleteByIdsAsync<T>(IDbConnection, IEnumerable, Action<IDbCommand>, CancellationToken)

Delete all rows identified by the PrimaryKeys. E.g: <p>db.DeleteByIdsAsync<Person>(new[] { 1, 2, 3 })</p>

View Source
Declaration
public static Task<int> DeleteByIdsAsync<T>(this IDbConnection dbConn, IEnumerable idValues, Action<IDbCommand> commandFilter = null, CancellationToken token = null)
Returns

Task<System.Int32>: number of rows deleted

Parameters
TypeName
IDbConnectiondbConn
IEnumerableidValues
Action<IDbCommand>commandFilter
CancellationTokentoken
Type Parameters
  • T

DeleteAllAsync<T>(IDbConnection, CancellationToken)

Delete all rows in the generic table type. E.g: <p>db.DeleteAllAsync<Person>()</p>

View Source
Declaration
public static Task<int> DeleteAllAsync<T>(this IDbConnection dbConn, CancellationToken token = null)
Returns

Task<System.Int32>: number of rows deleted

Parameters
TypeName
IDbConnectiondbConn
CancellationTokentoken
Type Parameters
  • T

DeleteAllAsync(IDbConnection, Type, CancellationToken)

Delete all rows in the runtime table type. E.g: <p>db.DeleteAllAsync(typeof(Person))</p>

View Source
Declaration
public static Task<int> DeleteAllAsync(this IDbConnection dbConn, Type tableType, CancellationToken token = null)
Returns

Task<System.Int32>: number of rows deleted

Parameters
TypeName
IDbConnectiondbConn
TypetableType
CancellationTokentoken

DeleteAsync<T>(IDbConnection, String, Object, CancellationToken)

Delete rows using sqlfilter, e.g: <p>db.DeleteAsync<Person>("FirstName = @FirstName AND Age = @Age", new { FirstName = "Jimi", Age = 27 })</p>

View Source
Declaration
public static Task<int> DeleteAsync<T>(this IDbConnection dbConn, string sqlFilter, object anonType, CancellationToken token = null)
Returns

Task<System.Int32>

Parameters
TypeName
IDbConnectiondbConn
System.StringsqlFilter
System.ObjectanonType
CancellationTokentoken
Type Parameters
  • T

DeleteAsync(IDbConnection, Type, String, Object, CancellationToken)

Delete rows using sqlfilter and Runtime Type, e.g: <p>db.DeleteAsync(typeof(Person), "FirstName = @FirstName AND Age = @Age", new { FirstName = "Jimi", Age = 27 })</p>

View Source
Declaration
public static Task<int> DeleteAsync(this IDbConnection dbConn, Type tableType, string sqlFilter, object anonType, CancellationToken token = null)
Returns

Task<System.Int32>

Parameters
TypeName
IDbConnectiondbConn
TypetableType
System.StringsqlFilter
System.ObjectanonType
CancellationTokentoken

SaveAsync<T>(IDbConnection, T, Boolean, CancellationToken)

Insert a new row or update existing row. Returns true if a new row was inserted. Optional references param decides whether to save all related references as well. E.g: <p>db.SaveAsync(customer, references:true)</p>

View Source
Declaration
public static async Task<bool> SaveAsync<T>(this IDbConnection dbConn, T obj, bool references = false, CancellationToken token = null)
Returns

Task<System.Boolean>: true if a row was inserted; false if it was updated

Parameters
TypeName
IDbConnectiondbConn
<T>obj
System.Booleanreferences
CancellationTokentoken
Type Parameters
  • T

SaveAsync<T>(IDbConnection, CancellationToken, T[])

Insert new rows or update existing rows. Return number of rows added E.g: <p>db.SaveAsync(new Person { Id = 10, FirstName = "Amy", LastName = "Winehouse", Age = 27 })</p>

View Source
Declaration
public static Task<int> SaveAsync<T>(this IDbConnection dbConn, CancellationToken token, params T[] objs)
Returns

Task<System.Int32>: number of rows added

Parameters
TypeName
IDbConnectiondbConn
CancellationTokentoken
<T>[]objs
Type Parameters
  • T

SaveAsync<T>(IDbConnection, T[])

View Source
Declaration
public static Task<int> SaveAsync<T>(this IDbConnection dbConn, params T[] objs)
Returns

Task<System.Int32>

Parameters
TypeName
IDbConnectiondbConn
<T>[]objs
Type Parameters
  • T

SaveAllAsync<T>(IDbConnection, IEnumerable<T>, CancellationToken)

Insert new rows or update existing rows. Return number of rows added E.g: <p>db.SaveAllAsync(new [] { new Person { Id = 10, FirstName = "Amy", LastName = "Winehouse", Age = 27 } })</p>

View Source
Declaration
public static Task<int> SaveAllAsync<T>(this IDbConnection dbConn, IEnumerable<T> objs, CancellationToken token = null)
Returns

Task<System.Int32>: number of rows added

Parameters
TypeName
IDbConnectiondbConn
IEnumerable<<T>>objs
CancellationTokentoken
Type Parameters
  • T

SaveAllReferencesAsync<T>(IDbConnection, T, CancellationToken)

Populates all related references on the instance with its primary key and saves them. Uses '(T)Id' naming convention. E.g: <p>db.SaveAllReferences(customer)</p>

View Source
Declaration
public static Task SaveAllReferencesAsync<T>(this IDbConnection dbConn, T instance, CancellationToken token = null)
Returns

Task

Parameters
TypeName
IDbConnectiondbConn
<T>instance
CancellationTokentoken
Type Parameters
  • T

SaveReferencesAsync<T, TRef>(IDbConnection, CancellationToken, T, TRef[])

Populates the related references with the instance primary key and saves them. Uses '(T)Id' naming convention. E.g: <p>db.SaveReference(customer, customer.Orders)</p>

View Source
Declaration
public static Task SaveReferencesAsync<T, TRef>(this IDbConnection dbConn, CancellationToken token, T instance, params TRef[] refs)
Returns

Task

Parameters
TypeName
IDbConnectiondbConn
CancellationTokentoken
<T>instance
<TRef>[]refs
Type Parameters
  • T
  • TRef

SaveReferencesAsync<T, TRef>(IDbConnection, T, TRef[])

View Source
Declaration
public static Task SaveReferencesAsync<T, TRef>(this IDbConnection dbConn, T instance, params TRef[] refs)
Returns

Task

Parameters
TypeName
IDbConnectiondbConn
<T>instance
<TRef>[]refs
Type Parameters
  • T
  • TRef

SaveReferencesAsync<T, TRef>(IDbConnection, T, List<TRef>, CancellationToken)

Populates the related references with the instance primary key and saves them. Uses '(T)Id' naming convention. E.g: <p>db.SaveReference(customer, customer.Orders)</p>

View Source
Declaration
public static Task SaveReferencesAsync<T, TRef>(this IDbConnection dbConn, T instance, List<TRef> refs, CancellationToken token = null)
Returns

Task

Parameters
TypeName
IDbConnectiondbConn
<T>instance
List<<TRef>>refs
CancellationTokentoken
Type Parameters
  • T
  • TRef

SaveReferencesAsync<T, TRef>(IDbConnection, T, IEnumerable<TRef>, CancellationToken)

Populates the related references with the instance primary key and saves them. Uses '(T)Id' naming convention. E.g: <p>db.SaveReferences(customer, customer.Orders)</p>

View Source
Declaration
public static Task SaveReferencesAsync<T, TRef>(this IDbConnection dbConn, T instance, IEnumerable<TRef> refs, CancellationToken token)
Returns

Task

Parameters
TypeName
IDbConnectiondbConn
<T>instance
IEnumerable<<TRef>>refs
CancellationTokentoken
Type Parameters
  • T
  • TRef

GetRowVersionAsync<T>(IDbConnection, Object, CancellationToken)

View Source
Declaration
public static Task<object> GetRowVersionAsync<T>(this IDbConnection dbConn, object id, CancellationToken token = null)
Returns

Task<System.Object>

Parameters
TypeName
IDbConnectiondbConn
System.Objectid
CancellationTokentoken
Type Parameters
  • T

GetRowVersionAsync(IDbConnection, Type, Object, CancellationToken)

View Source
Declaration
public static Task<object> GetRowVersionAsync(this IDbConnection dbConn, Type modelType, object id, CancellationToken token = null)
Returns

Task<System.Object>

Parameters
TypeName
IDbConnectiondbConn
TypemodelType
System.Objectid
CancellationTokentoken

ExecuteProcedureAsync<T>(IDbConnection, T, CancellationToken)

View Source
Declaration
public static Task ExecuteProcedureAsync<T>(this IDbConnection dbConn, T obj, CancellationToken token = null)
Returns

Task

Parameters
TypeName
IDbConnectiondbConn
<T>obj
CancellationTokentoken
Type Parameters
  • T