예제 #1
0
        public static async Task <IEnumerable <T> > GetByWhereAsync <T>(this IDbConnection conn, ISqlBuilder builder, List <ConditionParameter <T> > conditionParameters, object param = null, string returnFields = null, string orderBy = null, IDbTransaction tran = null, int?commandTimeout = null)
        {
            foreach (var conditionParameter in conditionParameters)
            {
                builder.Criteria.AddCondition(conditionParameter.FieldName, conditionParameter.Comparison, conditionParameter.Val, conditionParameter.Tag, conditionParameter.ConditionType);
            }

            return(await conn.QueryAsync <T>(builder.GetByWhereSql <T>(builder.BuildConditions(true), returnFields, orderBy), param, tran, commandTimeout));
        }
예제 #2
0
 public static async Task <IEnumerable <T> > GetByWhereAsync <T>(this IDbConnection conn, ISqlBuilder builder, Expression <Func <T, bool> > exp, object param = null, string returnFields = null, string orderBy = null, IDbTransaction tran = null, int?commandTimeout = null)
 {
     return(await conn.QueryAsync <T>(builder.GetByWhereSql <T>(builder.BuildConditions(exp), returnFields, orderBy), param, tran, commandTimeout));
 }