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

namespace TimeBarFirstLook_WCF_RIA
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.ComponentModel.DataAnnotations;
    using System.Linq;
    using System.ServiceModel.DomainServices;
    using System.ServiceModel.DomainServices.Client;
    using System.ServiceModel.DomainServices.Client.ApplicationServices;
    
    
    /// <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="System.Windows.Application.ApplicationLifetimeObjects"/>
        public new static WebContext Current
        {
            get
            {
                return ((WebContext)(WebContextBase.Current));
            }
        }
    }
}
namespace TimeBarFirstLook_WCF_RIA.Web
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.ComponentModel.DataAnnotations;
    using System.Linq;
    using System.Runtime.Serialization;
    using System.ServiceModel;
    using System.ServiceModel.DomainServices;
    using System.ServiceModel.DomainServices.Client;
    using System.ServiceModel.DomainServices.Client.ApplicationServices;
    using System.ServiceModel.Web;
    
    
    /// <summary>
    /// The domain context corresponding to the 'FlightStatisticsService' domain service.
    /// </summary>
    public sealed partial class FlightStatisticsContext : 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>
        /// Initializes a new instance of the <see cref="FlightStatisticsContext"/> class.
        /// </summary>
        public FlightStatisticsContext() : 
                this(new WebDomainClient<IFlightStatisticsServiceContract>(new Uri("TimeBarFirstLook_WCF_RIA-Web-FlightStatisticsService.svc", UriKind.Relative)))
        {
        }
        
        /// <summary>
        /// Initializes a new instance of the <see cref="FlightStatisticsContext"/> class with the specified service URI.
        /// </summary>
        /// <param name="serviceUri">The FlightStatisticsService service URI.</param>
        public FlightStatisticsContext(Uri serviceUri) : 
                this(new WebDomainClient<IFlightStatisticsServiceContract>(serviceUri))
        {
        }
        
        /// <summary>
        /// Initializes a new instance of the <see cref="FlightStatisticsContext"/> class with the specified <paramref name="domainClient"/>.
        /// </summary>
        /// <param name="domainClient">The DomainClient instance to use for this domain context.</param>
        public FlightStatisticsContext(DomainClient domainClient) : 
                base(domainClient)
        {
            this.OnCreated();
        }
        
        /// <summary>
        /// Gets the set of <see cref="FlightStatisticsView"/> entities that have been loaded into this <see cref="FlightStatisticsContext"/> instance.
        /// </summary>
        public EntitySet<FlightStatisticsView> FlightStatisticsViews
        {
            get
            {
                return base.EntityContainer.GetEntitySet<FlightStatisticsView>();
            }
        }
        
        /// <summary>
        /// Gets an EntityQuery instance that can be used to load <see cref="FlightStatisticsView"/> entities using the 'GetFlightStatisticsViews' query.
        /// </summary>
        /// <returns>An EntityQuery that can be loaded to retrieve <see cref="FlightStatisticsView"/> entities.</returns>
        public EntityQuery<FlightStatisticsView> GetFlightStatisticsViewsQuery()
        {
            this.ValidateMethod("GetFlightStatisticsViewsQuery", null);
            return base.CreateQuery<FlightStatisticsView>("GetFlightStatisticsViews", null, false, true);
        }
        
        /// <summary>
        /// Creates a new entity container for this domain context's entity sets.
        /// </summary>
        /// <returns>A new container instance.</returns>
        protected override EntityContainer CreateEntityContainer()
        {
            return new FlightStatisticsContextEntityContainer();
        }
        
        /// <summary>
        /// Service contract for the 'FlightStatisticsService' domain service.
        /// </summary>
        [ServiceContract()]
        public interface IFlightStatisticsServiceContract
        {
            
            /// <summary>
            /// Asynchronously invokes the 'GetFlightStatisticsViews' operation.
            /// </summary>
            /// <param name="callback">Callback to invoke on completion.</param>
            /// <param name="asyncState">Optional state object.</param>
            /// <returns>An IAsyncResult that can be used to monitor the request.</returns>
            [FaultContract(typeof(DomainServiceFault), Action="http://tempuri.org/FlightStatisticsService/GetFlightStatisticsViewsDomainServiceF" +
                "ault", Name="DomainServiceFault", Namespace="DomainServices")]
            [OperationContract(AsyncPattern=true, Action="http://tempuri.org/FlightStatisticsService/GetFlightStatisticsViews", ReplyAction="http://tempuri.org/FlightStatisticsService/GetFlightStatisticsViewsResponse")]
            [WebGet()]
            IAsyncResult BeginGetFlightStatisticsViews(AsyncCallback callback, object asyncState);
            
            /// <summary>
            /// Completes the asynchronous operation begun by 'BeginGetFlightStatisticsViews'.
            /// </summary>
            /// <param name="result">The IAsyncResult returned from 'BeginGetFlightStatisticsViews'.</param>
            /// <returns>The 'QueryResult' returned from the 'GetFlightStatisticsViews' operation.</returns>
            QueryResult<FlightStatisticsView> EndGetFlightStatisticsViews(IAsyncResult result);
            
            /// <summary>
            /// Asynchronously invokes the 'SubmitChanges' operation.
            /// </summary>
            /// <param name="changeSet">The change-set to submit.</param>
            /// <param name="callback">Callback to invoke on completion.</param>
            /// <param name="asyncState">Optional state object.</param>
            /// <returns>An IAsyncResult that can be used to monitor the request.</returns>
            [FaultContract(typeof(DomainServiceFault), Action="http://tempuri.org/FlightStatisticsService/SubmitChangesDomainServiceFault", Name="DomainServiceFault", Namespace="DomainServices")]
            [OperationContract(AsyncPattern=true, Action="http://tempuri.org/FlightStatisticsService/SubmitChanges", ReplyAction="http://tempuri.org/FlightStatisticsService/SubmitChangesResponse")]
            IAsyncResult BeginSubmitChanges(IEnumerable<ChangeSetEntry> changeSet, AsyncCallback callback, object asyncState);
            
            /// <summary>
            /// Completes the asynchronous operation begun by 'BeginSubmitChanges'.
            /// </summary>
            /// <param name="result">The IAsyncResult returned from 'BeginSubmitChanges'.</param>
            /// <returns>The collection of change-set entry elements returned from 'SubmitChanges'.</returns>
            IEnumerable<ChangeSetEntry> EndSubmitChanges(IAsyncResult result);
        }
        
        internal sealed class FlightStatisticsContextEntityContainer : EntityContainer
        {
            
            public FlightStatisticsContextEntityContainer()
            {
                this.CreateEntitySet<FlightStatisticsView>(EntitySetOperations.None);
            }
        }
    }
    
    /// <summary>
    /// The 'FlightStatisticsView' entity class.
    /// </summary>
    [DataContract(Namespace="http://schemas.datacontract.org/2004/07/TimeBarFirstLook_WCF_RIA.Web")]
    public sealed partial class FlightStatisticsView : Entity
    {
        
        private int _arrivals;
        
        private int _departures;
        
        private DateTime _timeStamp;
        
        private Nullable<int> _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 OnArrivalsChanging(int value);
        partial void OnArrivalsChanged();
        partial void OnDeparturesChanging(int value);
        partial void OnDeparturesChanged();
        partial void OnTimeStampChanging(DateTime value);
        partial void OnTimeStampChanged();
        partial void OnTotalChanging(Nullable<int> value);
        partial void OnTotalChanged();

        #endregion
        
        
        /// <summary>
        /// Initializes a new instance of the <see cref="FlightStatisticsView"/> class.
        /// </summary>
        public FlightStatisticsView()
        {
            this.OnCreated();
        }
        
        /// <summary>
        /// Gets or sets the 'Arrivals' value.
        /// </summary>
        [DataMember()]
        [Editable(false, AllowInitialValue=true)]
        [Key()]
        [RoundtripOriginal()]
        public int Arrivals
        {
            get
            {
                return this._arrivals;
            }
            set
            {
                if ((this._arrivals != value))
                {
                    this.OnArrivalsChanging(value);
                    this.ValidateProperty("Arrivals", value);
                    this._arrivals = value;
                    this.RaisePropertyChanged("Arrivals");
                    this.OnArrivalsChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'Departures' value.
        /// </summary>
        [DataMember()]
        [Editable(false, AllowInitialValue=true)]
        [Key()]
        [RoundtripOriginal()]
        public int Departures
        {
            get
            {
                return this._departures;
            }
            set
            {
                if ((this._departures != value))
                {
                    this.OnDeparturesChanging(value);
                    this.ValidateProperty("Departures", value);
                    this._departures = value;
                    this.RaisePropertyChanged("Departures");
                    this.OnDeparturesChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'TimeStamp' value.
        /// </summary>
        [DataMember()]
        [Editable(false, AllowInitialValue=true)]
        [Key()]
        [RoundtripOriginal()]
        public DateTime TimeStamp
        {
            get
            {
                return this._timeStamp;
            }
            set
            {
                if ((this._timeStamp != value))
                {
                    this.OnTimeStampChanging(value);
                    this.ValidateProperty("TimeStamp", value);
                    this._timeStamp = value;
                    this.RaisePropertyChanged("TimeStamp");
                    this.OnTimeStampChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'Total' value.
        /// </summary>
        [DataMember()]
        public Nullable<int> Total
        {
            get
            {
                return this._total;
            }
            set
            {
                if ((this._total != value))
                {
                    this.OnTotalChanging(value);
                    this.RaiseDataMemberChanging("Total");
                    this.ValidateProperty("Total", value);
                    this._total = value;
                    this.RaiseDataMemberChanged("Total");
                    this.OnTotalChanged();
                }
            }
        }
        
        /// <summary>
        /// Computes a value from the key fields that uniquely identifies this entity instance.
        /// </summary>
        /// <returns>An object instance that uniquely identifies this entity instance.</returns>
        public override object GetIdentity()
        {
            return EntityKey.Create(this._arrivals, this._departures, this._timeStamp);
        }
    }
}
