public static int Delete <T>(this IDbConnection dbConn, SqlExpressionVisitor <T> where) { return(dbConn.Exec(dbCmd => dbCmd.Delete(where))); }
public static int UpdateOnly <T>(this IDbConnection dbConn, T model, SqlExpressionVisitor <T> onlyFields) { return(dbConn.Exec(dbCmd => dbCmd.UpdateOnly(model, onlyFields))); }
public static void InsertOnly <T>(this IDbConnection dbConn, T obj, SqlExpressionVisitor <T> onlyFields) { dbConn.Exec(dbCmd => dbCmd.InsertOnly(obj, onlyFields)); }
/// <summary> /// Using an Expression Visitor to only Insert the fields specified, e.g: /// /// var ev = OrmLiteConfig.DialectProvider.ExpressionVisitor>Person<()); /// dbCmd.InsertOnly(new Person { FirstName = "Amy" }, ev.Insert(p => new { p.FirstName })); /// INSERT INTO "Person" ("FirstName") VALUES ('Amy'); /// </summary> public static void InsertOnly <T>(this IDbCommand dbCmd, T obj, SqlExpressionVisitor <T> onlyFields) { var sql = OrmLiteConfig.DialectProvider.ToInsertRowStatement(dbCmd, obj, onlyFields.InsertFields); dbCmd.ExecuteSql(sql); }
/// <summary> /// Delete the rows that matches the where expression, e.g: /// /// var ev = OrmLiteConfig.DialectProvider.ExpressionVisitor>Person<()); /// dbCmd.Delete<Person>(ev.Where(p => p.Age == 27)); /// DELETE FROM "Person" WHERE ("Age" = 27) /// </summary> public static int Delete <T>(this IDbCommand dbCmd, SqlExpressionVisitor <T> where) { var sql = where.ToDeleteRowStatement(); return(dbCmd.ExecuteSql(sql)); }
public static long Count <T>(this IDbCommand dbCmd, SqlExpressionVisitor <T> expression) { string sql = expression.ToCountStatement(); return(dbCmd.GetScalar <long>(sql)); }
public static long Count <T>(this IDbConnection dbConn) { SqlExpressionVisitor <T> expression = OrmLiteConfig.DialectProvider.ExpressionVisitor <T>(); return(dbConn.Exec(dbCmd => dbCmd.Count(expression))); }
public static long Count <T>(this IDbConnection dbConn, SqlExpressionVisitor <T> expression) { return(dbConn.Exec(dbCmd => dbCmd.Count(expression))); }
public static T FirstOrDefault <T>(this IDbConnection dbConn, SqlExpressionVisitor <T> expression) { return(dbConn.Exec(dbCmd => dbCmd.FirstOrDefault(expression))); }
public static List <T> Select <T>(this IDbConnection dbConn, SqlExpressionVisitor <T> expression) { return(dbConn.Exec(dbCmd => dbCmd.Select(expression))); }