public static void Printf <T>(FluentExpressionSQLCore <T> expression2Sql, string description = "") { // string sql = expression2Sql.ToSqlString(); string comment = "--"; if (!string.IsNullOrWhiteSpace(description)) { Print(comment + description); } if (ExpressionSqlBuilder.ExistSubQuery()) { foreach (KeyValuePair <string, object> item in ExpressionSqlBuilder.GetExistDbParameters()) { Print(comment + item.ToString() + " --- " + item.Value.GetType()); } } //Console.WriteLine(expression2Sql.RawString); Print("-------------------参数----------------------------"); foreach (KeyValuePair <string, object> item in expression2Sql.DbParams) { Print(comment + item.ToString() + " --- " + item.Value.GetType()); } Print("-------------------SQL----------------------------"); Print(expression2Sql.RawString); Print("-------------------RawSQL----------------------------"); Print(expression2Sql.ToSqlString()); Console.WriteLine(); Console.WriteLine(); }
public static async Task <int> ExecuteAsync <TEntity>(this IDatabase db, FluentExpressionSQLCore <TEntity> expression) where TEntity : class { return(await db.ExecuteAsync(expression.ToSqlString())); }
public static async Task <IEnumerable <TEntity> > ExecuteQueryAsync <TEntity>(this IDatabase db, FluentExpressionSQLCore <TEntity> expression) where TEntity : class { //string sql = expression.RawString; //return db.SqlQuery<TEntity>(sql, expression.DbParams); return(await db.SqlQueryAsync <TEntity>(expression.ToSqlString())); }