Skip to main content

OrmLiteWriteExpressionsApiAsyncLegacy

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

Methods

InsertOnlyAsync<T>(IDbConnection, T, Func<SqlExpression<T>, SqlExpression<T>>, CancellationToken)

Insert only fields in POCO specified by the SqlExpression lambda. E.g: <p>db.InsertOnly(new Person { FirstName = "Amy", Age = 27 }, q => q.Insert(p => new { p.FirstName, p.Age }))</p>

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

Task

Parameters
TypeName
IDbConnectiondbConn
<T>obj
Func<ServiceStack.OrmLite.SqlExpression<<T>>,ServiceStack.OrmLite.SqlExpression<<T>>>onlyFields
CancellationTokentoken
Type Parameters
  • T

InsertOnlyAsync<T>(IDbConnection, T, SqlExpression<T>, CancellationToken)

Using an SqlExpression to only Insert the fields specified, e.g:

db.InsertOnly(new Person { FirstName = "Amy" }, q => q.Insert(p => new { p.FirstName })); INSERT INTO "Person" ("FirstName") VALUES ('Amy');

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

Task

Parameters
TypeName
IDbConnectiondbConn
<T>obj
ServiceStack.OrmLite.SqlExpression<T>onlyFields
CancellationTokentoken
Type Parameters
  • T

UpdateOnlyAsync<T>(IDbConnection, T, Func<SqlExpression<T>, SqlExpression<T>>, CancellationToken)

Use an SqlExpression to select which fields to update and construct the where expression, E.g:

db.UpdateOnly(new Person { FirstName = "JJ" }, ev => ev.Update(p => p.FirstName).Where(x => x.FirstName == "Jimi")); UPDATE "Person" SET "FirstName" = 'JJ' WHERE ("FirstName" = 'Jimi')

What's not in the update expression doesn't get updated. No where expression updates all rows. E.g:

db.UpdateOnly(new Person { FirstName = "JJ", LastName = "Hendo" }, ev => ev.Update(p => p.FirstName)); UPDATE "Person" SET "FirstName" = 'JJ'

View Source
Declaration
public static Task<int> UpdateOnlyAsync<T>(this IDbConnection dbConn, T model, Func<SqlExpression<T>, SqlExpression<T>> onlyFields, CancellationToken token = null)
Returns

Task<System.Int32>

Parameters
TypeName
IDbConnectiondbConn
<T>model
Func<ServiceStack.OrmLite.SqlExpression<<T>>,ServiceStack.OrmLite.SqlExpression<<T>>>onlyFields
CancellationTokentoken
Type Parameters
  • T

UpdateFmtAsync<T>(IDbConnection, String, String, CancellationToken)

Flexible Update method to succinctly execute a free-text update statement using optional params. E.g:

db.Update<Person>(set:"FirstName = {0}".Params("JJ"), where:"LastName = {0}".Params("Hendrix")); UPDATE "Person" SET FirstName = 'JJ' WHERE LastName = 'Hendrix'

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

Task<System.Int32>

Parameters
TypeName
IDbConnectiondbConn
System.Stringset
System.Stringwhere
CancellationTokentoken
Type Parameters
  • T

UpdateFmtAsync(IDbConnection, String, String, String, CancellationToken)

Flexible Update method to succinctly execute a free-text update statement using optional params. E.g.

db.Update(table:"Person", set: "FirstName = {0}".Params("JJ"), where: "LastName = {0}".Params("Hendrix")); UPDATE "Person" SET FirstName = 'JJ' WHERE LastName = 'Hendrix'

View Source
Declaration
public static Task<int> UpdateFmtAsync(this IDbConnection dbConn, string table = null, string set = null, string where = null, CancellationToken token = null)
Returns

Task<System.Int32>

Parameters
TypeName
IDbConnectiondbConn
System.Stringtable
System.Stringset
System.Stringwhere
CancellationTokentoken

DeleteFmtAsync<T>(IDbConnection, String, CancellationToken)

Flexible Delete method to succinctly execute a delete statement using free-text where expression. E.g.

db.Delete<Person>(where:"Age = {0}".Params(27)); DELETE FROM "Person" WHERE Age = 27

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

Task<System.Int32>

Parameters
TypeName
IDbConnectiondbConn
System.Stringwhere
CancellationTokentoken
Type Parameters
  • T

DeleteFmtAsync<T>(IDbConnection, String)

View Source
Declaration
public static Task<int> DeleteFmtAsync<T>(this IDbConnection dbConn, string where = null)
Returns

Task<System.Int32>

Parameters
TypeName
IDbConnectiondbConn
System.Stringwhere
Type Parameters
  • T

DeleteFmtAsync(IDbConnection, String, String, CancellationToken)

Flexible Delete method to succinctly execute a delete statement using free-text where expression. E.g.

db.Delete(table:"Person", where: "Age = {0}".Params(27)); DELETE FROM "Person" WHERE Age = 27

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

Task<System.Int32>

Parameters
TypeName
IDbConnectiondbConn
System.Stringtable
System.Stringwhere
CancellationTokentoken

DeleteAsync<T>(IDbConnection, Func<SqlExpression<T>, SqlExpression<T>>, CancellationToken)

Delete the rows that matches the where expression, e.g:

db.Delete<Person>(ev => ev.Where(p => p.Age == 27)); DELETE FROM "Person" WHERE ("Age" = 27)

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

Task<System.Int32>

Parameters
TypeName
IDbConnectiondbConn
Func<ServiceStack.OrmLite.SqlExpression<<T>>,ServiceStack.OrmLite.SqlExpression<<T>>>where
CancellationTokentoken
Type Parameters
  • T