OrmLiteWriteApiAsync
Assembly: ServiceStack.OrmLite.dll
View Source
public static class OrmLiteWriteApiAsync : object
Methods
ExecuteSqlAsync(IDbConnection, String, CancellationToken)
Execute any arbitrary raw SQL.
View Source
public static Task<int> ExecuteSqlAsync(this IDbConnection dbConn, string sql, CancellationToken token = null)
Returns
Task<System.Int32>
: number of rows affected
Parameters
Type | Name |
---|---|
IDbConnection | dbConn |
System.String | sql |
CancellationToken | token |
ExecuteSqlAsync(IDbConnection, String, Object, CancellationToken)
Execute any arbitrary raw SQL with db params.
View Source
public static Task<int> ExecuteSqlAsync(this IDbConnection dbConn, string sql, object dbParams, CancellationToken token = null)
Returns
Task<System.Int32>
: number of rows affected
Parameters
Type | Name |
---|---|
IDbConnection | dbConn |
System.String | sql |
System.Object | dbParams |
CancellationToken | token |
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
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
Type | Name |
---|---|
IDbConnection | dbConn |
<T> | obj |
System.Boolean | selectIdentity |
System.Boolean | enableIdentityInsert |
CancellationToken | token |
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
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
Type | Name |
---|---|
IDbConnection | dbConn |
<T> | obj |
Action<IDbCommand> | commandFilter |
System.Boolean | selectIdentity |
System.Boolean | enableIdentityInsert |
CancellationToken | token |
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
public static Task<long> InsertAsync<T>(this IDbConnection dbConn, Dictionary<string, object> obj, bool selectIdentity = false, CancellationToken token = null)
Returns
Task<System.Int64>
Parameters
Type | Name |
---|---|
IDbConnection | dbConn |
Dictionary<System.String,System.Object> | obj |
System.Boolean | selectIdentity |
CancellationToken | token |
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
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
Type | Name |
---|---|
IDbConnection | dbConn |
Action<IDbCommand> | commandFilter |
Dictionary<System.String,System.Object> | obj |
System.Boolean | selectIdentity |
CancellationToken | token |
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
public static Task InsertAsync<T>(this IDbConnection dbConn, CancellationToken token, params T[] objs)
Returns
Task
Parameters
Type | Name |
---|---|
IDbConnection | dbConn |
CancellationToken | token |
<T>[] | objs |
Type Parameters
T
InsertAsync<T>(IDbConnection, T[])
View Source
public static Task InsertAsync<T>(this IDbConnection dbConn, params T[] objs)
Returns
Task
Parameters
Type | Name |
---|---|
IDbConnection | dbConn |
<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
public static Task InsertAsync<T>(this IDbConnection dbConn, Action<IDbCommand> commandFilter, CancellationToken token, params T[] objs)
Returns
Task
Parameters
Type | Name |
---|---|
IDbConnection | dbConn |
Action<IDbCommand> | commandFilter |
CancellationToken | token |
<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
public static Task InsertUsingDefaultsAsync<T>(this IDbConnection dbConn, T[] objs, CancellationToken token = null)
Returns
Task
Parameters
Type | Name |
---|---|
IDbConnection | dbConn |
<T>[] | objs |
CancellationToken | token |
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
public static Task<long> InsertIntoSelectAsync<T>(this IDbConnection dbConn, ISqlExpression query, CancellationToken token = null)
Returns
Task<System.Int64>
Parameters
Type | Name |
---|---|
IDbConnection | dbConn |
ServiceStack.OrmLite.ISqlExpression | query |
CancellationToken | token |
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
public static Task<long> InsertIntoSelectAsync<T>(this IDbConnection dbConn, ISqlExpression query, Action<IDbCommand> commandFilter, CancellationToken token = null)
Returns
Task<System.Int64>
Parameters
Type | Name |
---|---|
IDbConnection | dbConn |
ServiceStack.OrmLite.ISqlExpression | query |
Action<IDbCommand> | commandFilter |
CancellationToken | token |
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
public static Task InsertAllAsync<T>(this IDbConnection dbConn, IEnumerable<T> objs, CancellationToken token = null)
Returns
Task
Parameters
Type | Name |
---|---|
IDbConnection | dbConn |
IEnumerable<<T>> | objs |
CancellationToken | token |
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
public static Task InsertAllAsync<T>(this IDbConnection dbConn, IEnumerable<T> objs, Action<IDbCommand> commandFilter, CancellationToken token = null)
Returns
Task
Parameters
Type | Name |
---|---|
IDbConnection | dbConn |
IEnumerable<<T>> | objs |
Action<IDbCommand> | commandFilter |
CancellationToken | token |
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
public static Task<int> UpdateAsync<T>(this IDbConnection dbConn, T obj, Action<IDbCommand> commandFilter = null, CancellationToken token = null)
Returns
Task<System.Int32>
Parameters
Type | Name |
---|---|
IDbConnection | dbConn |
<T> | obj |
Action<IDbCommand> | commandFilter |
CancellationToken | token |
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
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
Type | Name |
---|---|
IDbConnection | dbConn |
Dictionary<System.String,System.Object> | obj |
Action<IDbCommand> | commandFilter |
CancellationToken | token |
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
public static Task<int> UpdateAsync<T>(this IDbConnection dbConn, CancellationToken token, params T[] objs)
Returns
Task<System.Int32>
Parameters
Type | Name |
---|---|
IDbConnection | dbConn |
CancellationToken | token |
<T>[] | objs |
Type Parameters
T
UpdateAsync<T>(IDbConnection, T[])
View Source
public static Task<int> UpdateAsync<T>(this IDbConnection dbConn, params T[] objs)
Returns
Task<System.Int32>
Parameters
Type | Name |
---|---|
IDbConnection | dbConn |
<T>[] | objs |
Type Parameters
T
UpdateAsync<T>(IDbConnection, Action<IDbCommand>, CancellationToken, T[])
View Source
public static Task<int> UpdateAsync<T>(this IDbConnection dbConn, Action<IDbCommand> commandFilter, CancellationToken token, params T[] objs)
Returns
Task<System.Int32>
Parameters
Type | Name |
---|---|
IDbConnection | dbConn |
Action<IDbCommand> | commandFilter |
CancellationToken | token |
<T>[] | objs |
Type Parameters
T
UpdateAsync<T>(IDbConnection, Action<IDbCommand>, T[])
View Source
public static Task<int> UpdateAsync<T>(this IDbConnection dbConn, Action<IDbCommand> commandFilter, params T[] objs)
Returns
Task<System.Int32>
Parameters
Type | Name |
---|---|
IDbConnection | dbConn |
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
public static Task<int> UpdateAllAsync<T>(this IDbConnection dbConn, IEnumerable<T> objs, Action<IDbCommand> commandFilter = null, CancellationToken token = null)
Returns
Task<System.Int32>
Parameters
Type | Name |
---|---|
IDbConnection | dbConn |
IEnumerable<<T>> | objs |
Action<IDbCommand> | commandFilter |
CancellationToken | token |
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
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
Type | Name |
---|---|
IDbConnection | dbConn |
System.Object | anonFilter |
Action<IDbCommand> | commandFilter |
CancellationToken | token |
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
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
Type | Name |
---|---|
IDbConnection | dbConn |
Dictionary<System.String,System.Object> | filters |
Action<IDbCommand> | commandFilter |
CancellationToken | token |
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
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
Type | Name |
---|---|
IDbConnection | dbConn |
<T> | allFieldsFilter |
Action<IDbCommand> | commandFilter |
CancellationToken | token |
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
public static Task<int> DeleteAsync<T>(this IDbConnection dbConn, Action<IDbCommand> commandFilter = null, CancellationToken token = null, params T[] allFieldsFilters)
Returns
Task<System.Int32>
Parameters
Type | Name |
---|---|
IDbConnection | dbConn |
Action<IDbCommand> | commandFilter |
CancellationToken | token |
<T>[] | allFieldsFilters |
Type Parameters
T
DeleteAsync<T>(IDbConnection, Action<IDbCommand>, T[])
View Source
public static Task<int> DeleteAsync<T>(this IDbConnection dbConn, Action<IDbCommand> commandFilter = null, params T[] allFieldsFilters)
Returns
Task<System.Int32>
Parameters
Type | Name |
---|---|
IDbConnection | dbConn |
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
public static Task<int> DeleteNonDefaultsAsync<T>(this IDbConnection dbConn, T nonDefaultsFilter, CancellationToken token = null)
Returns
Task<System.Int32>
: number of rows deleted
Parameters
Type | Name |
---|---|
IDbConnection | dbConn |
<T> | nonDefaultsFilter |
CancellationToken | token |
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
public static Task<int> DeleteNonDefaultsAsync<T>(this IDbConnection dbConn, CancellationToken token, params T[] nonDefaultsFilters)
Returns
Task<System.Int32>
: number of rows deleted
Parameters
Type | Name |
---|---|
IDbConnection | dbConn |
CancellationToken | token |
<T>[] | nonDefaultsFilters |
Type Parameters
T
DeleteNonDefaultsAsync<T>(IDbConnection, T[])
View Source
public static Task<int> DeleteNonDefaultsAsync<T>(this IDbConnection dbConn, params T[] nonDefaultsFilters)
Returns
Task<System.Int32>
Parameters
Type | Name |
---|---|
IDbConnection | dbConn |
<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
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
Type | Name |
---|---|
IDbConnection | dbConn |
System.Object | id |
Action<IDbCommand> | commandFilter |
CancellationToken | token |
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
public static Task DeleteByIdAsync<T>(this IDbConnection dbConn, object id, ulong rowVersion, Action<IDbCommand> commandFilter = null, CancellationToken token = null)
Returns
Task
Parameters
Type | Name |
---|---|
IDbConnection | dbConn |
System.Object | id |
System.UInt64 | rowVersion |
Action<IDbCommand> | commandFilter |
CancellationToken | token |
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
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
Type | Name |
---|---|
IDbConnection | dbConn |
IEnumerable | idValues |
Action<IDbCommand> | commandFilter |
CancellationToken | token |
Type Parameters
T
DeleteAllAsync<T>(IDbConnection, CancellationToken)
Delete all rows in the generic table type. E.g: <p>db.DeleteAllAsync<Person>()</p>
View Source
public static Task<int> DeleteAllAsync<T>(this IDbConnection dbConn, CancellationToken token = null)
Returns
Task<System.Int32>
: number of rows deleted
Parameters
Type | Name |
---|---|
IDbConnection | dbConn |
CancellationToken | token |
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
public static Task<int> DeleteAllAsync(this IDbConnection dbConn, Type tableType, CancellationToken token = null)
Returns
Task<System.Int32>
: number of rows deleted
Parameters
Type | Name |
---|---|
IDbConnection | dbConn |
Type | tableType |
CancellationToken | token |
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
public static Task<int> DeleteAsync<T>(this IDbConnection dbConn, string sqlFilter, object anonType, CancellationToken token = null)
Returns
Task<System.Int32>
Parameters
Type | Name |
---|---|
IDbConnection | dbConn |
System.String | sqlFilter |
System.Object | anonType |
CancellationToken | token |
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
public static Task<int> DeleteAsync(this IDbConnection dbConn, Type tableType, string sqlFilter, object anonType, CancellationToken token = null)
Returns
Task<System.Int32>
Parameters
Type | Name |
---|---|
IDbConnection | dbConn |
Type | tableType |
System.String | sqlFilter |
System.Object | anonType |
CancellationToken | token |
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
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
Type | Name |
---|---|
IDbConnection | dbConn |
<T> | obj |
System.Boolean | references |
CancellationToken | token |
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
public static Task<int> SaveAsync<T>(this IDbConnection dbConn, CancellationToken token, params T[] objs)
Returns
Task<System.Int32>
: number of rows added
Parameters
Type | Name |
---|---|
IDbConnection | dbConn |
CancellationToken | token |
<T>[] | objs |
Type Parameters
T
SaveAsync<T>(IDbConnection, T[])
View Source
public static Task<int> SaveAsync<T>(this IDbConnection dbConn, params T[] objs)
Returns
Task<System.Int32>
Parameters
Type | Name |
---|---|
IDbConnection | dbConn |
<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
public static Task<int> SaveAllAsync<T>(this IDbConnection dbConn, IEnumerable<T> objs, CancellationToken token = null)
Returns
Task<System.Int32>
: number of rows added
Parameters
Type | Name |
---|---|
IDbConnection | dbConn |
IEnumerable<<T>> | objs |
CancellationToken | token |
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
public static Task SaveAllReferencesAsync<T>(this IDbConnection dbConn, T instance, CancellationToken token = null)
Returns
Task
Parameters
Type | Name |
---|---|
IDbConnection | dbConn |
<T> | instance |
CancellationToken | token |
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
public static Task SaveReferencesAsync<T, TRef>(this IDbConnection dbConn, CancellationToken token, T instance, params TRef[] refs)
Returns
Task
Parameters
Type | Name |
---|---|
IDbConnection | dbConn |
CancellationToken | token |
<T> | instance |
<TRef>[] | refs |
Type Parameters
T
TRef
SaveReferencesAsync<T, TRef>(IDbConnection, T, TRef[])
View Source
public static Task SaveReferencesAsync<T, TRef>(this IDbConnection dbConn, T instance, params TRef[] refs)
Returns
Task
Parameters
Type | Name |
---|---|
IDbConnection | dbConn |
<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
public static Task SaveReferencesAsync<T, TRef>(this IDbConnection dbConn, T instance, List<TRef> refs, CancellationToken token = null)
Returns
Task
Parameters
Type | Name |
---|---|
IDbConnection | dbConn |
<T> | instance |
List<<TRef>> | refs |
CancellationToken | token |
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
public static Task SaveReferencesAsync<T, TRef>(this IDbConnection dbConn, T instance, IEnumerable<TRef> refs, CancellationToken token)
Returns
Task
Parameters
Type | Name |
---|---|
IDbConnection | dbConn |
<T> | instance |
IEnumerable<<TRef>> | refs |
CancellationToken | token |
Type Parameters
T
TRef
GetRowVersionAsync<T>(IDbConnection, Object, CancellationToken)
View Source
public static Task<object> GetRowVersionAsync<T>(this IDbConnection dbConn, object id, CancellationToken token = null)
Returns
Task<System.Object>
Parameters
Type | Name |
---|---|
IDbConnection | dbConn |
System.Object | id |
CancellationToken | token |
Type Parameters
T
GetRowVersionAsync(IDbConnection, Type, Object, CancellationToken)
View Source
public static Task<object> GetRowVersionAsync(this IDbConnection dbConn, Type modelType, object id, CancellationToken token = null)
Returns
Task<System.Object>
Parameters
Type | Name |
---|---|
IDbConnection | dbConn |
Type | modelType |
System.Object | id |
CancellationToken | token |
ExecuteProcedureAsync<T>(IDbConnection, T, CancellationToken)
View Source
public static Task ExecuteProcedureAsync<T>(this IDbConnection dbConn, T obj, CancellationToken token = null)
Returns
Task
Parameters
Type | Name |
---|---|
IDbConnection | dbConn |
<T> | obj |
CancellationToken | token |
Type Parameters
T