Exemplo n.º 1
0
        public virtual IEnumerable <Order> GetOrders()
        {
            var resultOrders = new List <Order>();

            using (var connection = connectionDB.CreateConnection())
            {
                using (var command = connection.CreateCommand())
                {
                    command.CommandText = "select OrderID, OrderDate, ShipName, ShipAddress, ShippedDate from dbo.Orders";
                    command.CommandType = CommandType.Text;
                    using (var reader = command.ExecuteReader())
                    {
                        while (reader != null && reader.Read())
                        {
                            resultOrders.Add(mappingObject.MapReaderToObject <Order>(reader));
                        }
                    }
                }
            }
            return(resultOrders);
        }