public async Task <List <T> > GetAllFilteredBy(Expression <Func <T, bool> > condition)
        {
            var entity              = new T();
            var entityDetails       = entity.GetEntityDetails();
            var translatedCondition = _expressionTranslator.TranslateToQueryResult(condition);
            var sqlQuery            = $"SELECT * FROM [{entityDetails.TableName}] WHERE {translatedCondition.SqlQueryParameterized}";

            using (IDbConnection db = new SqlConnection(ConnectionString))
                return((await db.QueryAsync <T>(sqlQuery, translatedCondition.Parameters)).ToList());
        }
Ejemplo n.º 2
0
 private QueryResult WhereClause <TEntity>(Expression <Func <TEntity, bool> > pred) where TEntity : class
 {
     return(expressionTranslator.TranslateToQueryResult(pred));
 }