public IEnumerable <TEntity> ReadAll() { var expression = _expressionProvider.ProvideReadAllExpression(_tableName); var entities = _connection.Query <TEntity>(expression, null, _transaction).ToList(); return(entities); }
public void LoadContext() { _connection.Open(); foreach (var tableName in _tableNames) { var expression = _sqlExpressionProvider.ProvideReadAllExpression(tableName); var sqlCommand = new SqlCommand { CommandText = expression, Connection = _connection }; _dataAdapter.SelectCommand = sqlCommand; _dataAdapter.Fill(_dataSet, tableName); } _connection.Close(); }
public IEnumerable <TEntity> ReadAll() { var expression = _expressionProvider.ProvideReadAllExpression(_tableName); var command = new SqlCommand(expression, _connection) { Transaction = _transaction }; var reader = command.ExecuteReader(); var entities = _dataMapper.MapToEntityList(reader); reader.Close(); return(entities); }