public TEntity Get(Expression <Func <TEntity, bool> > filter = null) { var dd = ExpressionExtensions.ToMSSqlString(filter); var k = filter; throw new NotImplementedException(); }
/// <summary> /// /// </summary> /// <param name="filter">this filter works just only AND , OR operators</param> /// <returns></returns> public IEnumerable <T> GetAll(Expression filter = null) { using (var connection = CreateConnection()) { return((filter == null) ? connection.Query <T>($"SELECT * FROM {_tableName}") : connection.Query <T>($"SELECT * FROM {_tableName} where {ExpressionExtensions.ToMSSqlString(filter)}")); } }
/// <summary> /// /// </summary> /// <param name="filter">this filter works just only AND , OR operators</param> /// <returns></returns> public async Task <IEnumerable <T> > GetAllAsync(Expression filter = null) { using (var connection = CreateConnection()) { return(filter == null? await connection.QueryAsync <T>($"SELECT * FROM {_tableName}"): await connection.QueryAsync <T>($"SELECT * FROM {_tableName} where {ExpressionExtensions.ToMSSqlString(filter)}")); } }