示例#1
0
        public IEnumerable <TEntity> ReadAll()
        {
            var expression = _expressionProvider.ProvideReadAllExpression(_tableName);
            var entities   = _connection.Query <TEntity>(expression, null, _transaction).ToList();

            return(entities);
        }
示例#2
0
        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();
        }
示例#3
0
        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);
        }