예제 #1
0
 public static int Delete <T>(this IDbConnection dbConn, SqlExpressionVisitor <T> where)
 {
     return(dbConn.Exec(dbCmd => dbCmd.Delete(where)));
 }
예제 #2
0
 public static int UpdateOnly <T>(this IDbConnection dbConn, T model, SqlExpressionVisitor <T> onlyFields)
 {
     return(dbConn.Exec(dbCmd => dbCmd.UpdateOnly(model, onlyFields)));
 }
예제 #3
0
 public static void InsertOnly <T>(this IDbConnection dbConn, T obj, SqlExpressionVisitor <T> onlyFields)
 {
     dbConn.Exec(dbCmd => dbCmd.InsertOnly(obj, onlyFields));
 }
예제 #4
0
        /// <summary>
        /// Using an Expression Visitor to only Insert the fields specified, e.g:
        ///
        ///   var ev = OrmLiteConfig.DialectProvider.ExpressionVisitor&gt;Person&lt;());
        ///   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);
        }
예제 #5
0
        /// <summary>
        /// Delete the rows that matches the where expression, e.g:
        ///
        ///   var ev = OrmLiteConfig.DialectProvider.ExpressionVisitor&gt;Person&lt;());
        ///   dbCmd.Delete&lt;Person&gt;(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));
        }
예제 #6
0
        public static long Count <T>(this IDbCommand dbCmd, SqlExpressionVisitor <T> expression)
        {
            string sql = expression.ToCountStatement();

            return(dbCmd.GetScalar <long>(sql));
        }
예제 #7
0
        public static long Count <T>(this IDbConnection dbConn)
        {
            SqlExpressionVisitor <T> expression = OrmLiteConfig.DialectProvider.ExpressionVisitor <T>();

            return(dbConn.Exec(dbCmd => dbCmd.Count(expression)));
        }
예제 #8
0
 public static long Count <T>(this IDbConnection dbConn, SqlExpressionVisitor <T> expression)
 {
     return(dbConn.Exec(dbCmd => dbCmd.Count(expression)));
 }
예제 #9
0
 public static T FirstOrDefault <T>(this IDbConnection dbConn, SqlExpressionVisitor <T> expression)
 {
     return(dbConn.Exec(dbCmd => dbCmd.FirstOrDefault(expression)));
 }
예제 #10
0
 public static List <T> Select <T>(this IDbConnection dbConn, SqlExpressionVisitor <T> expression)
 {
     return(dbConn.Exec(dbCmd => dbCmd.Select(expression)));
 }