//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:2.0.50727.4927
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace PagingIPagedCollectionView
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.ComponentModel.DataAnnotations;
    using System.Linq;
    using System.Web.Ria.Data;
    using System.Windows.Ria;
    using System.Windows.Ria.Services;
    
    
    /// <summary>
    /// Context for the RIA application.
    /// </summary>
    /// <remarks>
    /// This context extends the base to make application services and types available
    /// for consumption from code and xaml.
    /// </remarks>
    public sealed partial class WebContext : WebContextBase
    {
        
        #region Extensibility Method Definitions

        /// <summary>
        /// This method is invoked from the constructor once initialization is complete and
        /// can be used for further object setup.
        /// </summary>
        partial void OnCreated();

        #endregion
        
        
        /// <summary>
        /// Initializes a new instance of the WebContext class.
        /// </summary>
        public WebContext()
        {
            this.OnCreated();
        }
        
        /// <summary>
        /// Gets the context that is registered as a lifetime object with the current application.
        /// </summary>
        /// <exception cref="InvalidOperationException"> is thrown if there is no current application,
        /// no contexts have been added, or more than one context has been added.
        /// </exception>
        /// <seealso cref="Application.ApplicationLifetimeObjects"/>
        public new static WebContext Current
        {
            get
            {
                return ((WebContext)(WebContextBase.Current));
            }
        }
    }
}
namespace PagingIPagedCollectionView.Web.Models
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.ComponentModel.DataAnnotations;
    using System.Linq;
    using System.Runtime.Serialization;
    using System.Web.Ria.Data;
    using System.Windows.Ria;
    using System.Windows.Ria.Services;
    
    
    [DataContract(Namespace="http://schemas.datacontract.org/2004/07/PagingIPagedCollectionView.Web.Models")]
    public sealed partial class Invoice : Entity
    {
        
        private string _billingAddress;
        
        private string _billingCity;
        
        private string _billingCountry;
        
        private string _billingPostalCode;
        
        private string _billingState;
        
        private int _customerId;
        
        private DateTime _invoiceDate;
        
        private int _invoiceId;
        
        private decimal _total;
        
        #region Extensibility Method Definitions

        /// <summary>
        /// This method is invoked from the constructor once initialization is complete and
        /// can be used for further object setup.
        /// </summary>
        partial void OnCreated();
        partial void OnBillingAddressChanging(string value);
        partial void OnBillingAddressChanged();
        partial void OnBillingCityChanging(string value);
        partial void OnBillingCityChanged();
        partial void OnBillingCountryChanging(string value);
        partial void OnBillingCountryChanged();
        partial void OnBillingPostalCodeChanging(string value);
        partial void OnBillingPostalCodeChanged();
        partial void OnBillingStateChanging(string value);
        partial void OnBillingStateChanged();
        partial void OnCustomerIdChanging(int value);
        partial void OnCustomerIdChanged();
        partial void OnInvoiceDateChanging(DateTime value);
        partial void OnInvoiceDateChanged();
        partial void OnInvoiceIdChanging(int value);
        partial void OnInvoiceIdChanged();
        partial void OnTotalChanging(decimal value);
        partial void OnTotalChanged();

        #endregion
        
        
        /// <summary>
        /// Default constructor.
        /// </summary>
        public Invoice()
        {
            this.OnCreated();
        }
        
        [DataMember()]
        [StringLength(70)]
        public string BillingAddress
        {
            get
            {
                return this._billingAddress;
            }
            set
            {
                if ((this._billingAddress != value))
                {
                    this.ValidateProperty("BillingAddress", value);
                    this.OnBillingAddressChanging(value);
                    this.RaiseDataMemberChanging("BillingAddress");
                    this._billingAddress = value;
                    this.RaiseDataMemberChanged("BillingAddress");
                    this.OnBillingAddressChanged();
                }
            }
        }
        
        [DataMember()]
        [StringLength(40)]
        public string BillingCity
        {
            get
            {
                return this._billingCity;
            }
            set
            {
                if ((this._billingCity != value))
                {
                    this.ValidateProperty("BillingCity", value);
                    this.OnBillingCityChanging(value);
                    this.RaiseDataMemberChanging("BillingCity");
                    this._billingCity = value;
                    this.RaiseDataMemberChanged("BillingCity");
                    this.OnBillingCityChanged();
                }
            }
        }
        
        [DataMember()]
        [StringLength(40)]
        public string BillingCountry
        {
            get
            {
                return this._billingCountry;
            }
            set
            {
                if ((this._billingCountry != value))
                {
                    this.ValidateProperty("BillingCountry", value);
                    this.OnBillingCountryChanging(value);
                    this.RaiseDataMemberChanging("BillingCountry");
                    this._billingCountry = value;
                    this.RaiseDataMemberChanged("BillingCountry");
                    this.OnBillingCountryChanged();
                }
            }
        }
        
        [DataMember()]
        [StringLength(10)]
        public string BillingPostalCode
        {
            get
            {
                return this._billingPostalCode;
            }
            set
            {
                if ((this._billingPostalCode != value))
                {
                    this.ValidateProperty("BillingPostalCode", value);
                    this.OnBillingPostalCodeChanging(value);
                    this.RaiseDataMemberChanging("BillingPostalCode");
                    this._billingPostalCode = value;
                    this.RaiseDataMemberChanged("BillingPostalCode");
                    this.OnBillingPostalCodeChanged();
                }
            }
        }
        
        [DataMember()]
        [StringLength(40)]
        public string BillingState
        {
            get
            {
                return this._billingState;
            }
            set
            {
                if ((this._billingState != value))
                {
                    this.ValidateProperty("BillingState", value);
                    this.OnBillingStateChanging(value);
                    this.RaiseDataMemberChanging("BillingState");
                    this._billingState = value;
                    this.RaiseDataMemberChanged("BillingState");
                    this.OnBillingStateChanged();
                }
            }
        }
        
        [DataMember()]
        public int CustomerId
        {
            get
            {
                return this._customerId;
            }
            set
            {
                if ((this._customerId != value))
                {
                    this.ValidateProperty("CustomerId", value);
                    this.OnCustomerIdChanging(value);
                    this.RaiseDataMemberChanging("CustomerId");
                    this._customerId = value;
                    this.RaiseDataMemberChanged("CustomerId");
                    this.OnCustomerIdChanged();
                }
            }
        }
        
        [DataMember()]
        public DateTime InvoiceDate
        {
            get
            {
                return this._invoiceDate;
            }
            set
            {
                if ((this._invoiceDate != value))
                {
                    this.ValidateProperty("InvoiceDate", value);
                    this.OnInvoiceDateChanging(value);
                    this.RaiseDataMemberChanging("InvoiceDate");
                    this._invoiceDate = value;
                    this.RaiseDataMemberChanged("InvoiceDate");
                    this.OnInvoiceDateChanged();
                }
            }
        }
        
        [DataMember()]
        [Key()]
        public int InvoiceId
        {
            get
            {
                return this._invoiceId;
            }
            set
            {
                if ((this._invoiceId != value))
                {
                    this.ValidateProperty("InvoiceId", value);
                    this.OnInvoiceIdChanging(value);
                    this.RaiseDataMemberChanging("InvoiceId");
                    this._invoiceId = value;
                    this.RaiseDataMemberChanged("InvoiceId");
                    this.OnInvoiceIdChanged();
                }
            }
        }
        
        [DataMember()]
        public decimal Total
        {
            get
            {
                return this._total;
            }
            set
            {
                if ((this._total != value))
                {
                    this.ValidateProperty("Total", value);
                    this.OnTotalChanging(value);
                    this.RaiseDataMemberChanging("Total");
                    this._total = value;
                    this.RaiseDataMemberChanged("Total");
                    this.OnTotalChanged();
                }
            }
        }
        
        public override object GetIdentity()
        {
            return this._invoiceId;
        }
    }
}
namespace PagingIPagedCollectionView.Web.Services
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.ComponentModel.DataAnnotations;
    using System.Linq;
    using System.ServiceModel;
    using System.Web.Ria.Data;
    using System.Windows.Ria;
    using System.Windows.Ria.Services;
    using PagingIPagedCollectionView.Web.Models;
    
    
    public sealed partial class ChinookDomainContext : DomainContext
    {
        
        #region Extensibility Method Definitions

        /// <summary>
        /// This method is invoked from the constructor once initialization is complete and
        /// can be used for further object setup.
        /// </summary>
        partial void OnCreated();

        #endregion
        
        
        /// <summary>
        /// Default constructor.
        /// </summary>
        public ChinookDomainContext() : 
                this(new WebDomainClient<IChinookDomainServiceContract>(new Uri("PagingIPagedCollectionView-Web-Services-ChinookDomainService.svc", UriKind.Relative)))
        {
        }
        
        /// <summary>
        /// Constructor used to specify a data service URI.
        /// </summary>
        /// <param name="serviceUri">
        /// The ChinookDomainService data service URI.
        /// </param>
        public ChinookDomainContext(Uri serviceUri) : 
                this(new WebDomainClient<IChinookDomainServiceContract>(serviceUri))
        {
        }
        
        /// <summary>
        /// Constructor used to specify a DomainClient instance.
        /// </summary>
        /// <param name="domainClient">
        /// The DomainClient instance the DomainContext should use.
        /// </param>
        public ChinookDomainContext(DomainClient domainClient) : 
                base(domainClient)
        {
            this.OnCreated();
        }
        
        public EntitySet<Invoice> Invoices
        {
            get
            {
                return base.EntityContainer.GetEntitySet<Invoice>();
            }
        }
        
        /// <summary>
        /// Returns an EntityQuery for query operation 'GetInvoices'.
        /// </summary>
        public EntityQuery<Invoice> GetInvoicesQuery()
        {
            this.ValidateMethod("GetInvoicesQuery", null);
            return base.CreateQuery<Invoice>("GetInvoices", null, false, true);
        }
        
        protected override EntityContainer CreateEntityContainer()
        {
            return new ChinookDomainContextEntityContainer();
        }
        
        [ServiceContract()]
        public interface IChinookDomainServiceContract
        {
            
            [FaultContract(typeof(DomainServiceFault), Action="http://tempuri.org/ChinookDomainService/GetInvoicesDomainServiceFault", Name="DomainServiceFault", Namespace="DomainServices")]
            [OperationContract(AsyncPattern=true, Action="http://tempuri.org/ChinookDomainService/GetInvoices", ReplyAction="http://tempuri.org/ChinookDomainService/GetInvoicesResponse")]
            IAsyncResult BeginGetInvoices(AsyncCallback callback, object asyncState);
            
            QueryResult<Invoice> EndGetInvoices(IAsyncResult result);
            
            [FaultContract(typeof(DomainServiceFault), Action="http://tempuri.org/ChinookDomainService/SubmitChangesDomainServiceFault", Name="DomainServiceFault", Namespace="DomainServices")]
            [OperationContract(AsyncPattern=true, Action="http://tempuri.org/ChinookDomainService/SubmitChanges", ReplyAction="http://tempuri.org/ChinookDomainService/SubmitChangesResponse")]
            IAsyncResult BeginSubmitChanges(IEnumerable<ChangeSetEntry> changeSet, AsyncCallback callback, object asyncState);
            
            IEnumerable<ChangeSetEntry> EndSubmitChanges(IAsyncResult result);
        }
        
        internal sealed class ChinookDomainContextEntityContainer : EntityContainer
        {
            
            public ChinookDomainContextEntityContainer()
            {
                this.CreateEntitySet<Invoice>(EntitySetOperations.None);
            }
        }
    }
}
