using System.Linq;
using System.Data.Services.Client;

namespace SilverlightApplication1.ServiceReference1
{
    public partial class Order
    {
        public Order()
        {
            _Order_Details = null;
        }

        internal NorthwindEntities Context { get; set; }

        public DataServiceCollection<Order_Detail> OrderDetailsCollection
        {
            get
            {
                if (_Order_Details == null && Context != null)
                {
                    _Order_Details = new DataServiceCollection<Order_Detail>(Context);
                    _Order_Details.LoadAsync(from o in Context.Order_Details
                                             where o.OrderID == this.OrderID
                                             select o);
                }
                return _Order_Details;
            }
        }

    }
}
