Click here to Skip to main content
Click here to Skip to main content
 
Add your own
alternative version

Integrate Reporting Services with Silverlight and RIA Services

, 28 Jul 2010 CPOL
Integrate Reporting Services with your Silverlight Line-of-Business applications.
ReportingServicesDemo.zip
ReportingServicesDemo
ReportingServicesDemo
Assets
Resources
Bin
Controls
Generated_Code
Models
Shared
Helpers
Libs
System.Windows.Controls.Data.DataForm.Toolkit.dll
Models
Properties
DataSources
ReportingServicesDemo.Web.ADWLTDomainContext.datasource
ReportingServicesDemo.Web.UserRegistrationContext.datasource
ReportingServicesDemo.csproj.user
Views
Login
Web
Resources
ReportingServicesDemo.Web
ADWLTModel.edmx
App_Data
bin
ClientBin
ReportingServicesDemo.xap
DemoReport.rdlc
Models
Shared
Properties
ReportingServicesDemo.Web.csproj.user
Resources
Services
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.1
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace ReportingServicesDemo
{
    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;
    using ReportingServicesDemo.Web;
    
    
    /// <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));
            }
        }
        
        /// <summary>
        /// Gets a user representing the authenticated identity.
        /// </summary>
        public new User User
        {
            get
            {
                return ((User)(base.User));
            }
        }
    }
}
namespace ReportingServicesDemo.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;
    using System.Xml.Serialization;
    using ReportingServicesDemo.Web.Resources;
    
    
    /// <summary>
    /// The 'Address' entity class.
    /// </summary>
    [DataContract(Namespace="http://schemas.datacontract.org/2004/07/ReportingServicesDemo.Web")]
    public sealed partial class Address : Entity
    {
        
        private int _addressID;
        
        private string _addressLine1;
        
        private string _addressLine2;
        
        private string _city;
        
        private string _countryRegion;
        
        private EntityCollection<CustomerAddress> _customerAddress;
        
        private DateTime _modifiedDate;
        
        private string _postalCode;
        
        private Guid _rowguid;
        
        private EntityCollection<SalesOrderHeader> _salesOrderHeader;
        
        private EntityCollection<SalesOrderHeader> _salesOrderHeader1;
        
        private string _stateProvince;
        
        #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 OnAddressIDChanging(int value);
        partial void OnAddressIDChanged();
        partial void OnAddressLine1Changing(string value);
        partial void OnAddressLine1Changed();
        partial void OnAddressLine2Changing(string value);
        partial void OnAddressLine2Changed();
        partial void OnCityChanging(string value);
        partial void OnCityChanged();
        partial void OnCountryRegionChanging(string value);
        partial void OnCountryRegionChanged();
        partial void OnModifiedDateChanging(DateTime value);
        partial void OnModifiedDateChanged();
        partial void OnPostalCodeChanging(string value);
        partial void OnPostalCodeChanged();
        partial void OnrowguidChanging(Guid value);
        partial void OnrowguidChanged();
        partial void OnStateProvinceChanging(string value);
        partial void OnStateProvinceChanged();

        #endregion
        
        
        /// <summary>
        /// Initializes a new instance of the <see cref="Address"/> class.
        /// </summary>
        public Address()
        {
            this.OnCreated();
        }
        
        /// <summary>
        /// Gets or sets the 'AddressID' value.
        /// </summary>
        [DataMember()]
        [Editable(false, AllowInitialValue=true)]
        [Key()]
        [RoundtripOriginal()]
        public int AddressID
        {
            get
            {
                return this._addressID;
            }
            set
            {
                if ((this._addressID != value))
                {
                    this.OnAddressIDChanging(value);
                    this.ValidateProperty("AddressID", value);
                    this._addressID = value;
                    this.RaisePropertyChanged("AddressID");
                    this.OnAddressIDChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'AddressLine1' value.
        /// </summary>
        [DataMember()]
        [Required()]
        [StringLength(60)]
        public string AddressLine1
        {
            get
            {
                return this._addressLine1;
            }
            set
            {
                if ((this._addressLine1 != value))
                {
                    this.OnAddressLine1Changing(value);
                    this.RaiseDataMemberChanging("AddressLine1");
                    this.ValidateProperty("AddressLine1", value);
                    this._addressLine1 = value;
                    this.RaiseDataMemberChanged("AddressLine1");
                    this.OnAddressLine1Changed();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'AddressLine2' value.
        /// </summary>
        [DataMember()]
        [StringLength(60)]
        public string AddressLine2
        {
            get
            {
                return this._addressLine2;
            }
            set
            {
                if ((this._addressLine2 != value))
                {
                    this.OnAddressLine2Changing(value);
                    this.RaiseDataMemberChanging("AddressLine2");
                    this.ValidateProperty("AddressLine2", value);
                    this._addressLine2 = value;
                    this.RaiseDataMemberChanged("AddressLine2");
                    this.OnAddressLine2Changed();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'City' value.
        /// </summary>
        [DataMember()]
        [Required()]
        [StringLength(30)]
        public string City
        {
            get
            {
                return this._city;
            }
            set
            {
                if ((this._city != value))
                {
                    this.OnCityChanging(value);
                    this.RaiseDataMemberChanging("City");
                    this.ValidateProperty("City", value);
                    this._city = value;
                    this.RaiseDataMemberChanged("City");
                    this.OnCityChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'CountryRegion' value.
        /// </summary>
        [DataMember()]
        [Required()]
        [StringLength(50)]
        public string CountryRegion
        {
            get
            {
                return this._countryRegion;
            }
            set
            {
                if ((this._countryRegion != value))
                {
                    this.OnCountryRegionChanging(value);
                    this.RaiseDataMemberChanging("CountryRegion");
                    this.ValidateProperty("CountryRegion", value);
                    this._countryRegion = value;
                    this.RaiseDataMemberChanged("CountryRegion");
                    this.OnCountryRegionChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets the collection of associated <see cref="CustomerAddress"/> entities.
        /// </summary>
        [Association("Address_CustomerAddress", "AddressID", "AddressID")]
        [XmlIgnore()]
        public EntityCollection<CustomerAddress> CustomerAddress
        {
            get
            {
                if ((this._customerAddress == null))
                {
                    this._customerAddress = new EntityCollection<CustomerAddress>(this, "CustomerAddress", this.FilterCustomerAddress, this.AttachCustomerAddress, this.DetachCustomerAddress);
                }
                return this._customerAddress;
            }
        }
        
        /// <summary>
        /// Gets or sets the 'ModifiedDate' value.
        /// </summary>
        [DataMember()]
        public DateTime ModifiedDate
        {
            get
            {
                return this._modifiedDate;
            }
            set
            {
                if ((this._modifiedDate != value))
                {
                    this.OnModifiedDateChanging(value);
                    this.RaiseDataMemberChanging("ModifiedDate");
                    this.ValidateProperty("ModifiedDate", value);
                    this._modifiedDate = value;
                    this.RaiseDataMemberChanged("ModifiedDate");
                    this.OnModifiedDateChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'PostalCode' value.
        /// </summary>
        [DataMember()]
        [Required()]
        [StringLength(15)]
        public string PostalCode
        {
            get
            {
                return this._postalCode;
            }
            set
            {
                if ((this._postalCode != value))
                {
                    this.OnPostalCodeChanging(value);
                    this.RaiseDataMemberChanging("PostalCode");
                    this.ValidateProperty("PostalCode", value);
                    this._postalCode = value;
                    this.RaiseDataMemberChanged("PostalCode");
                    this.OnPostalCodeChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'rowguid' value.
        /// </summary>
        [DataMember()]
        public Guid rowguid
        {
            get
            {
                return this._rowguid;
            }
            set
            {
                if ((this._rowguid != value))
                {
                    this.OnrowguidChanging(value);
                    this.RaiseDataMemberChanging("rowguid");
                    this.ValidateProperty("rowguid", value);
                    this._rowguid = value;
                    this.RaiseDataMemberChanged("rowguid");
                    this.OnrowguidChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets the collection of associated <see cref="SalesOrderHeader"/> entities.
        /// </summary>
        [Association("Address_SalesOrderHeader", "AddressID", "BillToAddressID")]
        [XmlIgnore()]
        public EntityCollection<SalesOrderHeader> SalesOrderHeader
        {
            get
            {
                if ((this._salesOrderHeader == null))
                {
                    this._salesOrderHeader = new EntityCollection<SalesOrderHeader>(this, "SalesOrderHeader", this.FilterSalesOrderHeader, this.AttachSalesOrderHeader, this.DetachSalesOrderHeader);
                }
                return this._salesOrderHeader;
            }
        }
        
        /// <summary>
        /// Gets the collection of associated <see cref="SalesOrderHeader"/> entities.
        /// </summary>
        [Association("Address_SalesOrderHeader1", "AddressID", "ShipToAddressID")]
        [XmlIgnore()]
        public EntityCollection<SalesOrderHeader> SalesOrderHeader1
        {
            get
            {
                if ((this._salesOrderHeader1 == null))
                {
                    this._salesOrderHeader1 = new EntityCollection<SalesOrderHeader>(this, "SalesOrderHeader1", this.FilterSalesOrderHeader1, this.AttachSalesOrderHeader1, this.DetachSalesOrderHeader1);
                }
                return this._salesOrderHeader1;
            }
        }
        
        /// <summary>
        /// Gets or sets the 'StateProvince' value.
        /// </summary>
        [DataMember()]
        [Required()]
        [StringLength(50)]
        public string StateProvince
        {
            get
            {
                return this._stateProvince;
            }
            set
            {
                if ((this._stateProvince != value))
                {
                    this.OnStateProvinceChanging(value);
                    this.RaiseDataMemberChanging("StateProvince");
                    this.ValidateProperty("StateProvince", value);
                    this._stateProvince = value;
                    this.RaiseDataMemberChanged("StateProvince");
                    this.OnStateProvinceChanged();
                }
            }
        }
        
        private void AttachCustomerAddress(CustomerAddress entity)
        {
            entity.Address = this;
        }
        
        private void DetachCustomerAddress(CustomerAddress entity)
        {
            entity.Address = null;
        }
        
        private bool FilterCustomerAddress(CustomerAddress entity)
        {
            return (entity.AddressID == this.AddressID);
        }
        
        private void AttachSalesOrderHeader(SalesOrderHeader entity)
        {
            entity.Address = this;
        }
        
        private void DetachSalesOrderHeader(SalesOrderHeader entity)
        {
            entity.Address = null;
        }
        
        private bool FilterSalesOrderHeader(SalesOrderHeader entity)
        {
            return (entity.BillToAddressID == this.AddressID);
        }
        
        private void AttachSalesOrderHeader1(SalesOrderHeader entity)
        {
            entity.Address1 = this;
        }
        
        private void DetachSalesOrderHeader1(SalesOrderHeader entity)
        {
            entity.Address1 = null;
        }
        
        private bool FilterSalesOrderHeader1(SalesOrderHeader entity)
        {
            return (entity.ShipToAddressID == this.AddressID);
        }
        
        /// <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 this._addressID;
        }
    }
    
    /// <summary>
    /// The domain context corresponding to the 'ADWLTDomainService' domain service.
    /// </summary>
    public sealed partial class ADWLTDomainContext : 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="ADWLTDomainContext"/> class.
        /// </summary>
        public ADWLTDomainContext() : 
                this(new WebDomainClient<IADWLTDomainServiceContract>(new Uri("ReportingServicesDemo-Web-ADWLTDomainService.svc", UriKind.Relative)))
        {
        }
        
        /// <summary>
        /// Initializes a new instance of the <see cref="ADWLTDomainContext"/> class with the specified service URI.
        /// </summary>
        /// <param name="serviceUri">The ADWLTDomainService service URI.</param>
        public ADWLTDomainContext(Uri serviceUri) : 
                this(new WebDomainClient<IADWLTDomainServiceContract>(serviceUri))
        {
        }
        
        /// <summary>
        /// Initializes a new instance of the <see cref="ADWLTDomainContext"/> class with the specified <paramref name="domainClient"/>.
        /// </summary>
        /// <param name="domainClient">The DomainClient instance to use for this domain context.</param>
        public ADWLTDomainContext(DomainClient domainClient) : 
                base(domainClient)
        {
            this.OnCreated();
        }
        
        /// <summary>
        /// Gets the set of <see cref="Address"/> entities that have been loaded into this <see cref="ADWLTDomainContext"/> instance.
        /// </summary>
        public EntitySet<Address> Addresses
        {
            get
            {
                return base.EntityContainer.GetEntitySet<Address>();
            }
        }
        
        /// <summary>
        /// Gets the set of <see cref="BuildVersion"/> entities that have been loaded into this <see cref="ADWLTDomainContext"/> instance.
        /// </summary>
        public EntitySet<BuildVersion> BuildVersions
        {
            get
            {
                return base.EntityContainer.GetEntitySet<BuildVersion>();
            }
        }
        
        /// <summary>
        /// Gets the set of <see cref="Customer"/> entities that have been loaded into this <see cref="ADWLTDomainContext"/> instance.
        /// </summary>
        public EntitySet<Customer> Customers
        {
            get
            {
                return base.EntityContainer.GetEntitySet<Customer>();
            }
        }
        
        /// <summary>
        /// Gets the set of <see cref="CustomerAddress"/> entities that have been loaded into this <see cref="ADWLTDomainContext"/> instance.
        /// </summary>
        public EntitySet<CustomerAddress> CustomerAddresses
        {
            get
            {
                return base.EntityContainer.GetEntitySet<CustomerAddress>();
            }
        }
        
        /// <summary>
        /// Gets the set of <see cref="ErrorLog"/> entities that have been loaded into this <see cref="ADWLTDomainContext"/> instance.
        /// </summary>
        public EntitySet<ErrorLog> ErrorLogs
        {
            get
            {
                return base.EntityContainer.GetEntitySet<ErrorLog>();
            }
        }
        
        /// <summary>
        /// Gets the set of <see cref="Orders"/> entities that have been loaded into this <see cref="ADWLTDomainContext"/> instance.
        /// </summary>
        public EntitySet<Orders> Orders
        {
            get
            {
                return base.EntityContainer.GetEntitySet<Orders>();
            }
        }
        
        /// <summary>
        /// Gets the set of <see cref="Product"/> entities that have been loaded into this <see cref="ADWLTDomainContext"/> instance.
        /// </summary>
        public EntitySet<Product> Products
        {
            get
            {
                return base.EntityContainer.GetEntitySet<Product>();
            }
        }
        
        /// <summary>
        /// Gets the set of <see cref="ProductCategory"/> entities that have been loaded into this <see cref="ADWLTDomainContext"/> instance.
        /// </summary>
        public EntitySet<ProductCategory> ProductCategories
        {
            get
            {
                return base.EntityContainer.GetEntitySet<ProductCategory>();
            }
        }
        
        /// <summary>
        /// Gets the set of <see cref="ProductDescription"/> entities that have been loaded into this <see cref="ADWLTDomainContext"/> instance.
        /// </summary>
        public EntitySet<ProductDescription> ProductDescriptions
        {
            get
            {
                return base.EntityContainer.GetEntitySet<ProductDescription>();
            }
        }
        
        /// <summary>
        /// Gets the set of <see cref="ProductModel"/> entities that have been loaded into this <see cref="ADWLTDomainContext"/> instance.
        /// </summary>
        public EntitySet<ProductModel> ProductModels
        {
            get
            {
                return base.EntityContainer.GetEntitySet<ProductModel>();
            }
        }
        
        /// <summary>
        /// Gets the set of <see cref="ProductModelProductDescription"/> entities that have been loaded into this <see cref="ADWLTDomainContext"/> instance.
        /// </summary>
        public EntitySet<ProductModelProductDescription> ProductModelProductDescriptions
        {
            get
            {
                return base.EntityContainer.GetEntitySet<ProductModelProductDescription>();
            }
        }
        
        /// <summary>
        /// Gets the set of <see cref="SalesOrderDetail"/> entities that have been loaded into this <see cref="ADWLTDomainContext"/> instance.
        /// </summary>
        public EntitySet<SalesOrderDetail> SalesOrderDetails
        {
            get
            {
                return base.EntityContainer.GetEntitySet<SalesOrderDetail>();
            }
        }
        
        /// <summary>
        /// Gets the set of <see cref="SalesOrderHeader"/> entities that have been loaded into this <see cref="ADWLTDomainContext"/> instance.
        /// </summary>
        public EntitySet<SalesOrderHeader> SalesOrderHeaders
        {
            get
            {
                return base.EntityContainer.GetEntitySet<SalesOrderHeader>();
            }
        }
        
        /// <summary>
        /// Gets an EntityQuery instance that can be used to load <see cref="Address"/> entities using the 'GetAddress' query.
        /// </summary>
        /// <returns>An EntityQuery that can be loaded to retrieve <see cref="Address"/> entities.</returns>
        public EntityQuery<Address> GetAddressQuery()
        {
            this.ValidateMethod("GetAddressQuery", null);
            return base.CreateQuery<Address>("GetAddress", null, false, true);
        }
        
        /// <summary>
        /// Gets an EntityQuery instance that can be used to load <see cref="BuildVersion"/> entities using the 'GetBuildVersion' query.
        /// </summary>
        /// <returns>An EntityQuery that can be loaded to retrieve <see cref="BuildVersion"/> entities.</returns>
        public EntityQuery<BuildVersion> GetBuildVersionQuery()
        {
            this.ValidateMethod("GetBuildVersionQuery", null);
            return base.CreateQuery<BuildVersion>("GetBuildVersion", null, false, true);
        }
        
        /// <summary>
        /// Gets an EntityQuery instance that can be used to load <see cref="Customer"/> entities using the 'GetCustomer' query.
        /// </summary>
        /// <returns>An EntityQuery that can be loaded to retrieve <see cref="Customer"/> entities.</returns>
        public EntityQuery<Customer> GetCustomerQuery()
        {
            this.ValidateMethod("GetCustomerQuery", null);
            return base.CreateQuery<Customer>("GetCustomer", null, false, true);
        }
        
        /// <summary>
        /// Gets an EntityQuery instance that can be used to load <see cref="CustomerAddress"/> entities using the 'GetCustomerAddress' query.
        /// </summary>
        /// <returns>An EntityQuery that can be loaded to retrieve <see cref="CustomerAddress"/> entities.</returns>
        public EntityQuery<CustomerAddress> GetCustomerAddressQuery()
        {
            this.ValidateMethod("GetCustomerAddressQuery", null);
            return base.CreateQuery<CustomerAddress>("GetCustomerAddress", null, false, true);
        }
        
        /// <summary>
        /// Gets an EntityQuery instance that can be used to load <see cref="ErrorLog"/> entities using the 'GetErrorLog' query.
        /// </summary>
        /// <returns>An EntityQuery that can be loaded to retrieve <see cref="ErrorLog"/> entities.</returns>
        public EntityQuery<ErrorLog> GetErrorLogQuery()
        {
            this.ValidateMethod("GetErrorLogQuery", null);
            return base.CreateQuery<ErrorLog>("GetErrorLog", null, false, true);
        }
        
        /// <summary>
        /// Gets an EntityQuery instance that can be used to load <see cref="Orders"/> entities using the 'GetOrderDetails' query.
        /// </summary>
        /// <param name="OrderID">The value for the 'OrderID' parameter of the query.</param>
        /// <returns>An EntityQuery that can be loaded to retrieve <see cref="Orders"/> entities.</returns>
        public EntityQuery<Orders> GetOrderDetailsQuery(int OrderID)
        {
            Dictionary<string, object> parameters = new Dictionary<string, object>();
            parameters.Add("OrderID", OrderID);
            this.ValidateMethod("GetOrderDetailsQuery", parameters);
            return base.CreateQuery<Orders>("GetOrderDetails", parameters, false, true);
        }
        
        /// <summary>
        /// Gets an EntityQuery instance that can be used to load <see cref="Product"/> entities using the 'GetProduct' query.
        /// </summary>
        /// <returns>An EntityQuery that can be loaded to retrieve <see cref="Product"/> entities.</returns>
        public EntityQuery<Product> GetProductQuery()
        {
            this.ValidateMethod("GetProductQuery", null);
            return base.CreateQuery<Product>("GetProduct", null, false, true);
        }
        
        /// <summary>
        /// Gets an EntityQuery instance that can be used to load <see cref="ProductCategory"/> entities using the 'GetProductCategory' query.
        /// </summary>
        /// <returns>An EntityQuery that can be loaded to retrieve <see cref="ProductCategory"/> entities.</returns>
        public EntityQuery<ProductCategory> GetProductCategoryQuery()
        {
            this.ValidateMethod("GetProductCategoryQuery", null);
            return base.CreateQuery<ProductCategory>("GetProductCategory", null, false, true);
        }
        
        /// <summary>
        /// Gets an EntityQuery instance that can be used to load <see cref="ProductDescription"/> entities using the 'GetProductDescription' query.
        /// </summary>
        /// <returns>An EntityQuery that can be loaded to retrieve <see cref="ProductDescription"/> entities.</returns>
        public EntityQuery<ProductDescription> GetProductDescriptionQuery()
        {
            this.ValidateMethod("GetProductDescriptionQuery", null);
            return base.CreateQuery<ProductDescription>("GetProductDescription", null, false, true);
        }
        
        /// <summary>
        /// Gets an EntityQuery instance that can be used to load <see cref="ProductModel"/> entities using the 'GetProductModel' query.
        /// </summary>
        /// <returns>An EntityQuery that can be loaded to retrieve <see cref="ProductModel"/> entities.</returns>
        public EntityQuery<ProductModel> GetProductModelQuery()
        {
            this.ValidateMethod("GetProductModelQuery", null);
            return base.CreateQuery<ProductModel>("GetProductModel", null, false, true);
        }
        
        /// <summary>
        /// Gets an EntityQuery instance that can be used to load <see cref="ProductModelProductDescription"/> entities using the 'GetProductModelProductDescription' query.
        /// </summary>
        /// <returns>An EntityQuery that can be loaded to retrieve <see cref="ProductModelProductDescription"/> entities.</returns>
        public EntityQuery<ProductModelProductDescription> GetProductModelProductDescriptionQuery()
        {
            this.ValidateMethod("GetProductModelProductDescriptionQuery", null);
            return base.CreateQuery<ProductModelProductDescription>("GetProductModelProductDescription", null, false, true);
        }
        
        /// <summary>
        /// Gets an EntityQuery instance that can be used to load <see cref="SalesOrderDetail"/> entities using the 'GetSalesOrderDetail' query.
        /// </summary>
        /// <returns>An EntityQuery that can be loaded to retrieve <see cref="SalesOrderDetail"/> entities.</returns>
        public EntityQuery<SalesOrderDetail> GetSalesOrderDetailQuery()
        {
            this.ValidateMethod("GetSalesOrderDetailQuery", null);
            return base.CreateQuery<SalesOrderDetail>("GetSalesOrderDetail", null, false, true);
        }
        
        /// <summary>
        /// Gets an EntityQuery instance that can be used to load <see cref="SalesOrderHeader"/> entities using the 'GetSalesOrderHeader' query.
        /// </summary>
        /// <returns>An EntityQuery that can be loaded to retrieve <see cref="SalesOrderHeader"/> entities.</returns>
        public EntityQuery<SalesOrderHeader> GetSalesOrderHeaderQuery()
        {
            this.ValidateMethod("GetSalesOrderHeaderQuery", null);
            return base.CreateQuery<SalesOrderHeader>("GetSalesOrderHeader", 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 ADWLTDomainContextEntityContainer();
        }
        
        /// <summary>
        /// Service contract for the 'ADWLTDomainService' domain service.
        /// </summary>
        [ServiceContract()]
        public interface IADWLTDomainServiceContract
        {
            
            /// <summary>
            /// Asynchronously invokes the 'GetAddress' 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/ADWLTDomainService/GetAddressDomainServiceFault", Name="DomainServiceFault", Namespace="DomainServices")]
            [OperationContract(AsyncPattern=true, Action="http://tempuri.org/ADWLTDomainService/GetAddress", ReplyAction="http://tempuri.org/ADWLTDomainService/GetAddressResponse")]
            [WebGet()]
            IAsyncResult BeginGetAddress(AsyncCallback callback, object asyncState);
            
            /// <summary>
            /// Completes the asynchronous operation begun by 'BeginGetAddress'.
            /// </summary>
            /// <param name="result">The IAsyncResult returned from 'BeginGetAddress'.</param>
            /// <returns>The 'QueryResult' returned from the 'GetAddress' operation.</returns>
            QueryResult<Address> EndGetAddress(IAsyncResult result);
            
            /// <summary>
            /// Asynchronously invokes the 'GetBuildVersion' 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/ADWLTDomainService/GetBuildVersionDomainServiceFault", Name="DomainServiceFault", Namespace="DomainServices")]
            [OperationContract(AsyncPattern=true, Action="http://tempuri.org/ADWLTDomainService/GetBuildVersion", ReplyAction="http://tempuri.org/ADWLTDomainService/GetBuildVersionResponse")]
            [WebGet()]
            IAsyncResult BeginGetBuildVersion(AsyncCallback callback, object asyncState);
            
            /// <summary>
            /// Completes the asynchronous operation begun by 'BeginGetBuildVersion'.
            /// </summary>
            /// <param name="result">The IAsyncResult returned from 'BeginGetBuildVersion'.</param>
            /// <returns>The 'QueryResult' returned from the 'GetBuildVersion' operation.</returns>
            QueryResult<BuildVersion> EndGetBuildVersion(IAsyncResult result);
            
            /// <summary>
            /// Asynchronously invokes the 'GetCustomer' 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/ADWLTDomainService/GetCustomerDomainServiceFault", Name="DomainServiceFault", Namespace="DomainServices")]
            [OperationContract(AsyncPattern=true, Action="http://tempuri.org/ADWLTDomainService/GetCustomer", ReplyAction="http://tempuri.org/ADWLTDomainService/GetCustomerResponse")]
            [WebGet()]
            IAsyncResult BeginGetCustomer(AsyncCallback callback, object asyncState);
            
            /// <summary>
            /// Completes the asynchronous operation begun by 'BeginGetCustomer'.
            /// </summary>
            /// <param name="result">The IAsyncResult returned from 'BeginGetCustomer'.</param>
            /// <returns>The 'QueryResult' returned from the 'GetCustomer' operation.</returns>
            QueryResult<Customer> EndGetCustomer(IAsyncResult result);
            
            /// <summary>
            /// Asynchronously invokes the 'GetCustomerAddress' 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/ADWLTDomainService/GetCustomerAddressDomainServiceFault", Name="DomainServiceFault", Namespace="DomainServices")]
            [OperationContract(AsyncPattern=true, Action="http://tempuri.org/ADWLTDomainService/GetCustomerAddress", ReplyAction="http://tempuri.org/ADWLTDomainService/GetCustomerAddressResponse")]
            [WebGet()]
            IAsyncResult BeginGetCustomerAddress(AsyncCallback callback, object asyncState);
            
            /// <summary>
            /// Completes the asynchronous operation begun by 'BeginGetCustomerAddress'.
            /// </summary>
            /// <param name="result">The IAsyncResult returned from 'BeginGetCustomerAddress'.</param>
            /// <returns>The 'QueryResult' returned from the 'GetCustomerAddress' operation.</returns>
            QueryResult<CustomerAddress> EndGetCustomerAddress(IAsyncResult result);
            
            /// <summary>
            /// Asynchronously invokes the 'GetErrorLog' 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/ADWLTDomainService/GetErrorLogDomainServiceFault", Name="DomainServiceFault", Namespace="DomainServices")]
            [OperationContract(AsyncPattern=true, Action="http://tempuri.org/ADWLTDomainService/GetErrorLog", ReplyAction="http://tempuri.org/ADWLTDomainService/GetErrorLogResponse")]
            [WebGet()]
            IAsyncResult BeginGetErrorLog(AsyncCallback callback, object asyncState);
            
            /// <summary>
            /// Completes the asynchronous operation begun by 'BeginGetErrorLog'.
            /// </summary>
            /// <param name="result">The IAsyncResult returned from 'BeginGetErrorLog'.</param>
            /// <returns>The 'QueryResult' returned from the 'GetErrorLog' operation.</returns>
            QueryResult<ErrorLog> EndGetErrorLog(IAsyncResult result);
            
            /// <summary>
            /// Asynchronously invokes the 'GetOrderDetails' operation.
            /// </summary>
            /// <param name="OrderID">The value for the 'OrderID' parameter of this action.</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/ADWLTDomainService/GetOrderDetailsDomainServiceFault", Name="DomainServiceFault", Namespace="DomainServices")]
            [OperationContract(AsyncPattern=true, Action="http://tempuri.org/ADWLTDomainService/GetOrderDetails", ReplyAction="http://tempuri.org/ADWLTDomainService/GetOrderDetailsResponse")]
            [WebGet()]
            IAsyncResult BeginGetOrderDetails(int OrderID, AsyncCallback callback, object asyncState);
            
            /// <summary>
            /// Completes the asynchronous operation begun by 'BeginGetOrderDetails'.
            /// </summary>
            /// <param name="result">The IAsyncResult returned from 'BeginGetOrderDetails'.</param>
            /// <returns>The 'QueryResult' returned from the 'GetOrderDetails' operation.</returns>
            QueryResult<Orders> EndGetOrderDetails(IAsyncResult result);
            
            /// <summary>
            /// Asynchronously invokes the 'GetProduct' 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/ADWLTDomainService/GetProductDomainServiceFault", Name="DomainServiceFault", Namespace="DomainServices")]
            [OperationContract(AsyncPattern=true, Action="http://tempuri.org/ADWLTDomainService/GetProduct", ReplyAction="http://tempuri.org/ADWLTDomainService/GetProductResponse")]
            [WebGet()]
            IAsyncResult BeginGetProduct(AsyncCallback callback, object asyncState);
            
            /// <summary>
            /// Completes the asynchronous operation begun by 'BeginGetProduct'.
            /// </summary>
            /// <param name="result">The IAsyncResult returned from 'BeginGetProduct'.</param>
            /// <returns>The 'QueryResult' returned from the 'GetProduct' operation.</returns>
            QueryResult<Product> EndGetProduct(IAsyncResult result);
            
            /// <summary>
            /// Asynchronously invokes the 'GetProductCategory' 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/ADWLTDomainService/GetProductCategoryDomainServiceFault", Name="DomainServiceFault", Namespace="DomainServices")]
            [OperationContract(AsyncPattern=true, Action="http://tempuri.org/ADWLTDomainService/GetProductCategory", ReplyAction="http://tempuri.org/ADWLTDomainService/GetProductCategoryResponse")]
            [WebGet()]
            IAsyncResult BeginGetProductCategory(AsyncCallback callback, object asyncState);
            
            /// <summary>
            /// Completes the asynchronous operation begun by 'BeginGetProductCategory'.
            /// </summary>
            /// <param name="result">The IAsyncResult returned from 'BeginGetProductCategory'.</param>
            /// <returns>The 'QueryResult' returned from the 'GetProductCategory' operation.</returns>
            QueryResult<ProductCategory> EndGetProductCategory(IAsyncResult result);
            
            /// <summary>
            /// Asynchronously invokes the 'GetProductDescription' 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/ADWLTDomainService/GetProductDescriptionDomainServiceFault", Name="DomainServiceFault", Namespace="DomainServices")]
            [OperationContract(AsyncPattern=true, Action="http://tempuri.org/ADWLTDomainService/GetProductDescription", ReplyAction="http://tempuri.org/ADWLTDomainService/GetProductDescriptionResponse")]
            [WebGet()]
            IAsyncResult BeginGetProductDescription(AsyncCallback callback, object asyncState);
            
            /// <summary>
            /// Completes the asynchronous operation begun by 'BeginGetProductDescription'.
            /// </summary>
            /// <param name="result">The IAsyncResult returned from 'BeginGetProductDescription'.</param>
            /// <returns>The 'QueryResult' returned from the 'GetProductDescription' operation.</returns>
            QueryResult<ProductDescription> EndGetProductDescription(IAsyncResult result);
            
            /// <summary>
            /// Asynchronously invokes the 'GetProductModel' 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/ADWLTDomainService/GetProductModelDomainServiceFault", Name="DomainServiceFault", Namespace="DomainServices")]
            [OperationContract(AsyncPattern=true, Action="http://tempuri.org/ADWLTDomainService/GetProductModel", ReplyAction="http://tempuri.org/ADWLTDomainService/GetProductModelResponse")]
            [WebGet()]
            IAsyncResult BeginGetProductModel(AsyncCallback callback, object asyncState);
            
            /// <summary>
            /// Completes the asynchronous operation begun by 'BeginGetProductModel'.
            /// </summary>
            /// <param name="result">The IAsyncResult returned from 'BeginGetProductModel'.</param>
            /// <returns>The 'QueryResult' returned from the 'GetProductModel' operation.</returns>
            QueryResult<ProductModel> EndGetProductModel(IAsyncResult result);
            
            /// <summary>
            /// Asynchronously invokes the 'GetProductModelProductDescription' 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/ADWLTDomainService/GetProductModelProductDescriptionDomainServ" +
                "iceFault", Name="DomainServiceFault", Namespace="DomainServices")]
            [OperationContract(AsyncPattern=true, Action="http://tempuri.org/ADWLTDomainService/GetProductModelProductDescription", ReplyAction="http://tempuri.org/ADWLTDomainService/GetProductModelProductDescriptionResponse")]
            [WebGet()]
            IAsyncResult BeginGetProductModelProductDescription(AsyncCallback callback, object asyncState);
            
            /// <summary>
            /// Completes the asynchronous operation begun by 'BeginGetProductModelProductDescription'.
            /// </summary>
            /// <param name="result">The IAsyncResult returned from 'BeginGetProductModelProductDescription'.</param>
            /// <returns>The 'QueryResult' returned from the 'GetProductModelProductDescription' operation.</returns>
            QueryResult<ProductModelProductDescription> EndGetProductModelProductDescription(IAsyncResult result);
            
            /// <summary>
            /// Asynchronously invokes the 'GetSalesOrderDetail' 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/ADWLTDomainService/GetSalesOrderDetailDomainServiceFault", Name="DomainServiceFault", Namespace="DomainServices")]
            [OperationContract(AsyncPattern=true, Action="http://tempuri.org/ADWLTDomainService/GetSalesOrderDetail", ReplyAction="http://tempuri.org/ADWLTDomainService/GetSalesOrderDetailResponse")]
            [WebGet()]
            IAsyncResult BeginGetSalesOrderDetail(AsyncCallback callback, object asyncState);
            
            /// <summary>
            /// Completes the asynchronous operation begun by 'BeginGetSalesOrderDetail'.
            /// </summary>
            /// <param name="result">The IAsyncResult returned from 'BeginGetSalesOrderDetail'.</param>
            /// <returns>The 'QueryResult' returned from the 'GetSalesOrderDetail' operation.</returns>
            QueryResult<SalesOrderDetail> EndGetSalesOrderDetail(IAsyncResult result);
            
            /// <summary>
            /// Asynchronously invokes the 'GetSalesOrderHeader' 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/ADWLTDomainService/GetSalesOrderHeaderDomainServiceFault", Name="DomainServiceFault", Namespace="DomainServices")]
            [OperationContract(AsyncPattern=true, Action="http://tempuri.org/ADWLTDomainService/GetSalesOrderHeader", ReplyAction="http://tempuri.org/ADWLTDomainService/GetSalesOrderHeaderResponse")]
            [WebGet()]
            IAsyncResult BeginGetSalesOrderHeader(AsyncCallback callback, object asyncState);
            
            /// <summary>
            /// Completes the asynchronous operation begun by 'BeginGetSalesOrderHeader'.
            /// </summary>
            /// <param name="result">The IAsyncResult returned from 'BeginGetSalesOrderHeader'.</param>
            /// <returns>The 'QueryResult' returned from the 'GetSalesOrderHeader' operation.</returns>
            QueryResult<SalesOrderHeader> EndGetSalesOrderHeader(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/ADWLTDomainService/SubmitChangesDomainServiceFault", Name="DomainServiceFault", Namespace="DomainServices")]
            [OperationContract(AsyncPattern=true, Action="http://tempuri.org/ADWLTDomainService/SubmitChanges", ReplyAction="http://tempuri.org/ADWLTDomainService/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 ADWLTDomainContextEntityContainer : EntityContainer
        {
            
            public ADWLTDomainContextEntityContainer()
            {
                this.CreateEntitySet<Address>(EntitySetOperations.All);
                this.CreateEntitySet<BuildVersion>(EntitySetOperations.All);
                this.CreateEntitySet<Customer>(EntitySetOperations.All);
                this.CreateEntitySet<CustomerAddress>(EntitySetOperations.All);
                this.CreateEntitySet<ErrorLog>(EntitySetOperations.All);
                this.CreateEntitySet<Orders>(EntitySetOperations.None);
                this.CreateEntitySet<Product>(EntitySetOperations.All);
                this.CreateEntitySet<ProductCategory>(EntitySetOperations.All);
                this.CreateEntitySet<ProductDescription>(EntitySetOperations.All);
                this.CreateEntitySet<ProductModel>(EntitySetOperations.All);
                this.CreateEntitySet<ProductModelProductDescription>(EntitySetOperations.All);
                this.CreateEntitySet<SalesOrderDetail>(EntitySetOperations.All);
                this.CreateEntitySet<SalesOrderHeader>(EntitySetOperations.All);
            }
        }
    }
    
    /// <summary>
    /// The domain context corresponding to the 'AuthenticationService' domain service.
    /// </summary>
    public sealed partial class AuthenticationContext : global::System.ServiceModel.DomainServices.Client.ApplicationServices.AuthenticationDomainContextBase
    {
        
        #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="AuthenticationContext"/> class.
        /// </summary>
        public AuthenticationContext() : 
                this(new WebDomainClient<IAuthenticationServiceContract>(new Uri("ReportingServicesDemo-Web-AuthenticationService.svc", UriKind.Relative)))
        {
        }
        
        /// <summary>
        /// Initializes a new instance of the <see cref="AuthenticationContext"/> class with the specified service URI.
        /// </summary>
        /// <param name="serviceUri">The AuthenticationService service URI.</param>
        public AuthenticationContext(Uri serviceUri) : 
                this(new WebDomainClient<IAuthenticationServiceContract>(serviceUri))
        {
        }
        
        /// <summary>
        /// Initializes a new instance of the <see cref="AuthenticationContext"/> class with the specified <paramref name="domainClient"/>.
        /// </summary>
        /// <param name="domainClient">The DomainClient instance to use for this domain context.</param>
        public AuthenticationContext(DomainClient domainClient) : 
                base(domainClient)
        {
            this.OnCreated();
        }
        
        /// <summary>
        /// Gets the set of <see cref="User"/> entities that have been loaded into this <see cref="AuthenticationContext"/> instance.
        /// </summary>
        public EntitySet<User> Users
        {
            get
            {
                return base.EntityContainer.GetEntitySet<User>();
            }
        }
        
        /// <summary>
        /// Gets an EntityQuery instance that can be used to load <see cref="User"/> entities using the 'GetUser' query.
        /// </summary>
        /// <returns>An EntityQuery that can be loaded to retrieve <see cref="User"/> entities.</returns>
        public EntityQuery<User> GetUserQuery()
        {
            this.ValidateMethod("GetUserQuery", null);
            return base.CreateQuery<User>("GetUser", null, false, false);
        }
        
        /// <summary>
        /// Gets an EntityQuery instance that can be used to load <see cref="User"/> entities using the 'Login' query.
        /// </summary>
        /// <param name="userName">The value for the 'userName' parameter of the query.</param>
        /// <param name="password">The value for the 'password' parameter of the query.</param>
        /// <param name="isPersistent">The value for the 'isPersistent' parameter of the query.</param>
        /// <param name="customData">The value for the 'customData' parameter of the query.</param>
        /// <returns>An EntityQuery that can be loaded to retrieve <see cref="User"/> entities.</returns>
        public EntityQuery<User> LoginQuery(string userName, string password, bool isPersistent, string customData)
        {
            Dictionary<string, object> parameters = new Dictionary<string, object>();
            parameters.Add("userName", userName);
            parameters.Add("password", password);
            parameters.Add("isPersistent", isPersistent);
            parameters.Add("customData", customData);
            this.ValidateMethod("LoginQuery", parameters);
            return base.CreateQuery<User>("Login", parameters, true, false);
        }
        
        /// <summary>
        /// Gets an EntityQuery instance that can be used to load <see cref="User"/> entities using the 'Logout' query.
        /// </summary>
        /// <returns>An EntityQuery that can be loaded to retrieve <see cref="User"/> entities.</returns>
        public EntityQuery<User> LogoutQuery()
        {
            this.ValidateMethod("LogoutQuery", null);
            return base.CreateQuery<User>("Logout", null, true, false);
        }
        
        /// <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 AuthenticationContextEntityContainer();
        }
        
        /// <summary>
        /// Service contract for the 'AuthenticationService' domain service.
        /// </summary>
        [ServiceContract()]
        public interface IAuthenticationServiceContract
        {
            
            /// <summary>
            /// Asynchronously invokes the 'GetUser' 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/AuthenticationService/GetUserDomainServiceFault", Name="DomainServiceFault", Namespace="DomainServices")]
            [OperationContract(AsyncPattern=true, Action="http://tempuri.org/AuthenticationService/GetUser", ReplyAction="http://tempuri.org/AuthenticationService/GetUserResponse")]
            [WebGet()]
            IAsyncResult BeginGetUser(AsyncCallback callback, object asyncState);
            
            /// <summary>
            /// Completes the asynchronous operation begun by 'BeginGetUser'.
            /// </summary>
            /// <param name="result">The IAsyncResult returned from 'BeginGetUser'.</param>
            /// <returns>The 'QueryResult' returned from the 'GetUser' operation.</returns>
            QueryResult<User> EndGetUser(IAsyncResult result);
            
            /// <summary>
            /// Asynchronously invokes the 'Login' operation.
            /// </summary>
            /// <param name="userName">The value for the 'userName' parameter of this action.</param>
            /// <param name="password">The value for the 'password' parameter of this action.</param>
            /// <param name="isPersistent">The value for the 'isPersistent' parameter of this action.</param>
            /// <param name="customData">The value for the 'customData' parameter of this action.</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/AuthenticationService/LoginDomainServiceFault", Name="DomainServiceFault", Namespace="DomainServices")]
            [OperationContract(AsyncPattern=true, Action="http://tempuri.org/AuthenticationService/Login", ReplyAction="http://tempuri.org/AuthenticationService/LoginResponse")]
            IAsyncResult BeginLogin(string userName, string password, bool isPersistent, string customData, AsyncCallback callback, object asyncState);
            
            /// <summary>
            /// Completes the asynchronous operation begun by 'BeginLogin'.
            /// </summary>
            /// <param name="result">The IAsyncResult returned from 'BeginLogin'.</param>
            /// <returns>The 'QueryResult' returned from the 'Login' operation.</returns>
            QueryResult<User> EndLogin(IAsyncResult result);
            
            /// <summary>
            /// Asynchronously invokes the 'Logout' 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/AuthenticationService/LogoutDomainServiceFault", Name="DomainServiceFault", Namespace="DomainServices")]
            [OperationContract(AsyncPattern=true, Action="http://tempuri.org/AuthenticationService/Logout", ReplyAction="http://tempuri.org/AuthenticationService/LogoutResponse")]
            IAsyncResult BeginLogout(AsyncCallback callback, object asyncState);
            
            /// <summary>
            /// Completes the asynchronous operation begun by 'BeginLogout'.
            /// </summary>
            /// <param name="result">The IAsyncResult returned from 'BeginLogout'.</param>
            /// <returns>The 'QueryResult' returned from the 'Logout' operation.</returns>
            QueryResult<User> EndLogout(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/AuthenticationService/SubmitChangesDomainServiceFault", Name="DomainServiceFault", Namespace="DomainServices")]
            [OperationContract(AsyncPattern=true, Action="http://tempuri.org/AuthenticationService/SubmitChanges", ReplyAction="http://tempuri.org/AuthenticationService/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 AuthenticationContextEntityContainer : EntityContainer
        {
            
            public AuthenticationContextEntityContainer()
            {
                this.CreateEntitySet<User>(EntitySetOperations.Edit);
            }
        }
    }
    
    /// <summary>
    /// The 'BuildVersion' entity class.
    /// </summary>
    [DataContract(Namespace="http://schemas.datacontract.org/2004/07/ReportingServicesDemo.Web")]
    public sealed partial class BuildVersion : Entity
    {
        
        private string _database_Version;
        
        private DateTime _modifiedDate;
        
        private byte _systemInformationID;
        
        private DateTime _versionDate;
        
        #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 OnDatabase_VersionChanging(string value);
        partial void OnDatabase_VersionChanged();
        partial void OnModifiedDateChanging(DateTime value);
        partial void OnModifiedDateChanged();
        partial void OnSystemInformationIDChanging(byte value);
        partial void OnSystemInformationIDChanged();
        partial void OnVersionDateChanging(DateTime value);
        partial void OnVersionDateChanged();

        #endregion
        
        
        /// <summary>
        /// Initializes a new instance of the <see cref="BuildVersion"/> class.
        /// </summary>
        public BuildVersion()
        {
            this.OnCreated();
        }
        
        /// <summary>
        /// Gets or sets the 'Database_Version' value.
        /// </summary>
        [DataMember()]
        [Editable(false, AllowInitialValue=true)]
        [Key()]
        [Required()]
        [RoundtripOriginal()]
        [StringLength(25)]
        public string Database_Version
        {
            get
            {
                return this._database_Version;
            }
            set
            {
                if ((this._database_Version != value))
                {
                    this.OnDatabase_VersionChanging(value);
                    this.ValidateProperty("Database_Version", value);
                    this._database_Version = value;
                    this.RaisePropertyChanged("Database_Version");
                    this.OnDatabase_VersionChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'ModifiedDate' value.
        /// </summary>
        [DataMember()]
        [Editable(false, AllowInitialValue=true)]
        [Key()]
        [RoundtripOriginal()]
        public DateTime ModifiedDate
        {
            get
            {
                return this._modifiedDate;
            }
            set
            {
                if ((this._modifiedDate != value))
                {
                    this.OnModifiedDateChanging(value);
                    this.ValidateProperty("ModifiedDate", value);
                    this._modifiedDate = value;
                    this.RaisePropertyChanged("ModifiedDate");
                    this.OnModifiedDateChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'SystemInformationID' value.
        /// </summary>
        [DataMember()]
        [Editable(false, AllowInitialValue=true)]
        [Key()]
        [RoundtripOriginal()]
        public byte SystemInformationID
        {
            get
            {
                return this._systemInformationID;
            }
            set
            {
                if ((this._systemInformationID != value))
                {
                    this.OnSystemInformationIDChanging(value);
                    this.ValidateProperty("SystemInformationID", value);
                    this._systemInformationID = value;
                    this.RaisePropertyChanged("SystemInformationID");
                    this.OnSystemInformationIDChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'VersionDate' value.
        /// </summary>
        [DataMember()]
        [Editable(false, AllowInitialValue=true)]
        [Key()]
        [RoundtripOriginal()]
        public DateTime VersionDate
        {
            get
            {
                return this._versionDate;
            }
            set
            {
                if ((this._versionDate != value))
                {
                    this.OnVersionDateChanging(value);
                    this.ValidateProperty("VersionDate", value);
                    this._versionDate = value;
                    this.RaisePropertyChanged("VersionDate");
                    this.OnVersionDateChanged();
                }
            }
        }
        
        /// <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._database_Version, this._modifiedDate, this._systemInformationID, this._versionDate);
        }
    }
    
    public enum CreateUserStatus
    {
        
        Success = 0,
        
        InvalidUserName = 1,
        
        InvalidPassword = 2,
        
        InvalidQuestion = 3,
        
        InvalidAnswer = 4,
        
        InvalidEmail = 5,
        
        DuplicateUserName = 6,
        
        DuplicateEmail = 7,
        
        Failure = 8,
    }
    
    /// <summary>
    /// The 'Customer' entity class.
    /// </summary>
    [DataContract(Namespace="http://schemas.datacontract.org/2004/07/ReportingServicesDemo.Web")]
    public sealed partial class Customer : Entity
    {
        
        private string _companyName;
        
        private EntityCollection<CustomerAddress> _customerAddress;
        
        private int _customerID;
        
        private string _emailAddress;
        
        private string _firstName;
        
        private string _lastName;
        
        private string _middleName;
        
        private DateTime _modifiedDate;
        
        private bool _nameStyle;
        
        private string _passwordHash;
        
        private string _passwordSalt;
        
        private string _phone;
        
        private Guid _rowguid;
        
        private EntityCollection<SalesOrderHeader> _salesOrderHeader;
        
        private string _salesPerson;
        
        private string _suffix;
        
        private string _title;
        
        #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 OnCompanyNameChanging(string value);
        partial void OnCompanyNameChanged();
        partial void OnCustomerIDChanging(int value);
        partial void OnCustomerIDChanged();
        partial void OnEmailAddressChanging(string value);
        partial void OnEmailAddressChanged();
        partial void OnFirstNameChanging(string value);
        partial void OnFirstNameChanged();
        partial void OnLastNameChanging(string value);
        partial void OnLastNameChanged();
        partial void OnMiddleNameChanging(string value);
        partial void OnMiddleNameChanged();
        partial void OnModifiedDateChanging(DateTime value);
        partial void OnModifiedDateChanged();
        partial void OnNameStyleChanging(bool value);
        partial void OnNameStyleChanged();
        partial void OnPasswordHashChanging(string value);
        partial void OnPasswordHashChanged();
        partial void OnPasswordSaltChanging(string value);
        partial void OnPasswordSaltChanged();
        partial void OnPhoneChanging(string value);
        partial void OnPhoneChanged();
        partial void OnrowguidChanging(Guid value);
        partial void OnrowguidChanged();
        partial void OnSalesPersonChanging(string value);
        partial void OnSalesPersonChanged();
        partial void OnSuffixChanging(string value);
        partial void OnSuffixChanged();
        partial void OnTitleChanging(string value);
        partial void OnTitleChanged();

        #endregion
        
        
        /// <summary>
        /// Initializes a new instance of the <see cref="Customer"/> class.
        /// </summary>
        public Customer()
        {
            this.OnCreated();
        }
        
        /// <summary>
        /// Gets or sets the 'CompanyName' value.
        /// </summary>
        [DataMember()]
        [StringLength(128)]
        public string CompanyName
        {
            get
            {
                return this._companyName;
            }
            set
            {
                if ((this._companyName != value))
                {
                    this.OnCompanyNameChanging(value);
                    this.RaiseDataMemberChanging("CompanyName");
                    this.ValidateProperty("CompanyName", value);
                    this._companyName = value;
                    this.RaiseDataMemberChanged("CompanyName");
                    this.OnCompanyNameChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets the collection of associated <see cref="CustomerAddress"/> entities.
        /// </summary>
        [Association("Customer_CustomerAddress", "CustomerID", "CustomerID")]
        [XmlIgnore()]
        public EntityCollection<CustomerAddress> CustomerAddress
        {
            get
            {
                if ((this._customerAddress == null))
                {
                    this._customerAddress = new EntityCollection<CustomerAddress>(this, "CustomerAddress", this.FilterCustomerAddress, this.AttachCustomerAddress, this.DetachCustomerAddress);
                }
                return this._customerAddress;
            }
        }
        
        /// <summary>
        /// Gets or sets the 'CustomerID' value.
        /// </summary>
        [DataMember()]
        [Editable(false, AllowInitialValue=true)]
        [Key()]
        [RoundtripOriginal()]
        public int CustomerID
        {
            get
            {
                return this._customerID;
            }
            set
            {
                if ((this._customerID != value))
                {
                    this.OnCustomerIDChanging(value);
                    this.ValidateProperty("CustomerID", value);
                    this._customerID = value;
                    this.RaisePropertyChanged("CustomerID");
                    this.OnCustomerIDChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'EmailAddress' value.
        /// </summary>
        [DataMember()]
        [StringLength(50)]
        public string EmailAddress
        {
            get
            {
                return this._emailAddress;
            }
            set
            {
                if ((this._emailAddress != value))
                {
                    this.OnEmailAddressChanging(value);
                    this.RaiseDataMemberChanging("EmailAddress");
                    this.ValidateProperty("EmailAddress", value);
                    this._emailAddress = value;
                    this.RaiseDataMemberChanged("EmailAddress");
                    this.OnEmailAddressChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'FirstName' value.
        /// </summary>
        [DataMember()]
        [Required()]
        [StringLength(50)]
        public string FirstName
        {
            get
            {
                return this._firstName;
            }
            set
            {
                if ((this._firstName != value))
                {
                    this.OnFirstNameChanging(value);
                    this.RaiseDataMemberChanging("FirstName");
                    this.ValidateProperty("FirstName", value);
                    this._firstName = value;
                    this.RaiseDataMemberChanged("FirstName");
                    this.OnFirstNameChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'LastName' value.
        /// </summary>
        [DataMember()]
        [Required()]
        [StringLength(50)]
        public string LastName
        {
            get
            {
                return this._lastName;
            }
            set
            {
                if ((this._lastName != value))
                {
                    this.OnLastNameChanging(value);
                    this.RaiseDataMemberChanging("LastName");
                    this.ValidateProperty("LastName", value);
                    this._lastName = value;
                    this.RaiseDataMemberChanged("LastName");
                    this.OnLastNameChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'MiddleName' value.
        /// </summary>
        [DataMember()]
        [StringLength(50)]
        public string MiddleName
        {
            get
            {
                return this._middleName;
            }
            set
            {
                if ((this._middleName != value))
                {
                    this.OnMiddleNameChanging(value);
                    this.RaiseDataMemberChanging("MiddleName");
                    this.ValidateProperty("MiddleName", value);
                    this._middleName = value;
                    this.RaiseDataMemberChanged("MiddleName");
                    this.OnMiddleNameChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'ModifiedDate' value.
        /// </summary>
        [DataMember()]
        public DateTime ModifiedDate
        {
            get
            {
                return this._modifiedDate;
            }
            set
            {
                if ((this._modifiedDate != value))
                {
                    this.OnModifiedDateChanging(value);
                    this.RaiseDataMemberChanging("ModifiedDate");
                    this.ValidateProperty("ModifiedDate", value);
                    this._modifiedDate = value;
                    this.RaiseDataMemberChanged("ModifiedDate");
                    this.OnModifiedDateChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'NameStyle' value.
        /// </summary>
        [DataMember()]
        public bool NameStyle
        {
            get
            {
                return this._nameStyle;
            }
            set
            {
                if ((this._nameStyle != value))
                {
                    this.OnNameStyleChanging(value);
                    this.RaiseDataMemberChanging("NameStyle");
                    this.ValidateProperty("NameStyle", value);
                    this._nameStyle = value;
                    this.RaiseDataMemberChanged("NameStyle");
                    this.OnNameStyleChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'PasswordHash' value.
        /// </summary>
        [DataMember()]
        [Required()]
        [StringLength(128)]
        public string PasswordHash
        {
            get
            {
                return this._passwordHash;
            }
            set
            {
                if ((this._passwordHash != value))
                {
                    this.OnPasswordHashChanging(value);
                    this.RaiseDataMemberChanging("PasswordHash");
                    this.ValidateProperty("PasswordHash", value);
                    this._passwordHash = value;
                    this.RaiseDataMemberChanged("PasswordHash");
                    this.OnPasswordHashChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'PasswordSalt' value.
        /// </summary>
        [DataMember()]
        [Required()]
        [StringLength(10)]
        public string PasswordSalt
        {
            get
            {
                return this._passwordSalt;
            }
            set
            {
                if ((this._passwordSalt != value))
                {
                    this.OnPasswordSaltChanging(value);
                    this.RaiseDataMemberChanging("PasswordSalt");
                    this.ValidateProperty("PasswordSalt", value);
                    this._passwordSalt = value;
                    this.RaiseDataMemberChanged("PasswordSalt");
                    this.OnPasswordSaltChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'Phone' value.
        /// </summary>
        [DataMember()]
        [StringLength(25)]
        public string Phone
        {
            get
            {
                return this._phone;
            }
            set
            {
                if ((this._phone != value))
                {
                    this.OnPhoneChanging(value);
                    this.RaiseDataMemberChanging("Phone");
                    this.ValidateProperty("Phone", value);
                    this._phone = value;
                    this.RaiseDataMemberChanged("Phone");
                    this.OnPhoneChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'rowguid' value.
        /// </summary>
        [DataMember()]
        public Guid rowguid
        {
            get
            {
                return this._rowguid;
            }
            set
            {
                if ((this._rowguid != value))
                {
                    this.OnrowguidChanging(value);
                    this.RaiseDataMemberChanging("rowguid");
                    this.ValidateProperty("rowguid", value);
                    this._rowguid = value;
                    this.RaiseDataMemberChanged("rowguid");
                    this.OnrowguidChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets the collection of associated <see cref="SalesOrderHeader"/> entities.
        /// </summary>
        [Association("Customer_SalesOrderHeader", "CustomerID", "CustomerID")]
        [XmlIgnore()]
        public EntityCollection<SalesOrderHeader> SalesOrderHeader
        {
            get
            {
                if ((this._salesOrderHeader == null))
                {
                    this._salesOrderHeader = new EntityCollection<SalesOrderHeader>(this, "SalesOrderHeader", this.FilterSalesOrderHeader, this.AttachSalesOrderHeader, this.DetachSalesOrderHeader);
                }
                return this._salesOrderHeader;
            }
        }
        
        /// <summary>
        /// Gets or sets the 'SalesPerson' value.
        /// </summary>
        [DataMember()]
        [StringLength(256)]
        public string SalesPerson
        {
            get
            {
                return this._salesPerson;
            }
            set
            {
                if ((this._salesPerson != value))
                {
                    this.OnSalesPersonChanging(value);
                    this.RaiseDataMemberChanging("SalesPerson");
                    this.ValidateProperty("SalesPerson", value);
                    this._salesPerson = value;
                    this.RaiseDataMemberChanged("SalesPerson");
                    this.OnSalesPersonChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'Suffix' value.
        /// </summary>
        [DataMember()]
        [StringLength(10)]
        public string Suffix
        {
            get
            {
                return this._suffix;
            }
            set
            {
                if ((this._suffix != value))
                {
                    this.OnSuffixChanging(value);
                    this.RaiseDataMemberChanging("Suffix");
                    this.ValidateProperty("Suffix", value);
                    this._suffix = value;
                    this.RaiseDataMemberChanged("Suffix");
                    this.OnSuffixChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'Title' value.
        /// </summary>
        [DataMember()]
        [StringLength(8)]
        public string Title
        {
            get
            {
                return this._title;
            }
            set
            {
                if ((this._title != value))
                {
                    this.OnTitleChanging(value);
                    this.RaiseDataMemberChanging("Title");
                    this.ValidateProperty("Title", value);
                    this._title = value;
                    this.RaiseDataMemberChanged("Title");
                    this.OnTitleChanged();
                }
            }
        }
        
        private void AttachCustomerAddress(CustomerAddress entity)
        {
            entity.Customer = this;
        }
        
        private void DetachCustomerAddress(CustomerAddress entity)
        {
            entity.Customer = null;
        }
        
        private bool FilterCustomerAddress(CustomerAddress entity)
        {
            return (entity.CustomerID == this.CustomerID);
        }
        
        private void AttachSalesOrderHeader(SalesOrderHeader entity)
        {
            entity.Customer = this;
        }
        
        private void DetachSalesOrderHeader(SalesOrderHeader entity)
        {
            entity.Customer = null;
        }
        
        private bool FilterSalesOrderHeader(SalesOrderHeader entity)
        {
            return (entity.CustomerID == this.CustomerID);
        }
        
        /// <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 this._customerID;
        }
    }
    
    /// <summary>
    /// The 'CustomerAddress' entity class.
    /// </summary>
    [DataContract(Namespace="http://schemas.datacontract.org/2004/07/ReportingServicesDemo.Web")]
    public sealed partial class CustomerAddress : Entity
    {
        
        private EntityRef<Address> _address;
        
        private int _addressID;
        
        private string _addressType;
        
        private EntityRef<Customer> _customer;
        
        private int _customerID;
        
        private DateTime _modifiedDate;
        
        private Guid _rowguid;
        
        #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 OnAddressIDChanging(int value);
        partial void OnAddressIDChanged();
        partial void OnAddressTypeChanging(string value);
        partial void OnAddressTypeChanged();
        partial void OnCustomerIDChanging(int value);
        partial void OnCustomerIDChanged();
        partial void OnModifiedDateChanging(DateTime value);
        partial void OnModifiedDateChanged();
        partial void OnrowguidChanging(Guid value);
        partial void OnrowguidChanged();

        #endregion
        
        
        /// <summary>
        /// Initializes a new instance of the <see cref="CustomerAddress"/> class.
        /// </summary>
        public CustomerAddress()
        {
            this.OnCreated();
        }
        
        /// <summary>
        /// Gets or sets the associated <see cref="Address"/> entity.
        /// </summary>
        [Association("Address_CustomerAddress", "AddressID", "AddressID", IsForeignKey=true)]
        [XmlIgnore()]
        public Address Address
        {
            get
            {
                if ((this._address == null))
                {
                    this._address = new EntityRef<Address>(this, "Address", this.FilterAddress);
                }
                return this._address.Entity;
            }
            set
            {
                Address previous = this.Address;
                if ((previous != value))
                {
                    this.ValidateProperty("Address", value);
                    if ((previous != null))
                    {
                        this._address.Entity = null;
                        previous.CustomerAddress.Remove(this);
                    }
                    if ((value != null))
                    {
                        this.AddressID = value.AddressID;
                    }
                    else
                    {
                        this.AddressID = default(int);
                    }
                    this._address.Entity = value;
                    if ((value != null))
                    {
                        value.CustomerAddress.Add(this);
                    }
                    this.RaisePropertyChanged("Address");
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'AddressID' value.
        /// </summary>
        [DataMember()]
        [Key()]
        [RoundtripOriginal()]
        public int AddressID
        {
            get
            {
                return this._addressID;
            }
            set
            {
                if ((this._addressID != value))
                {
                    this.OnAddressIDChanging(value);
                    this.RaiseDataMemberChanging("AddressID");
                    this.ValidateProperty("AddressID", value);
                    this._addressID = value;
                    this.RaiseDataMemberChanged("AddressID");
                    this.OnAddressIDChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'AddressType' value.
        /// </summary>
        [DataMember()]
        [Required()]
        [StringLength(50)]
        public string AddressType
        {
            get
            {
                return this._addressType;
            }
            set
            {
                if ((this._addressType != value))
                {
                    this.OnAddressTypeChanging(value);
                    this.RaiseDataMemberChanging("AddressType");
                    this.ValidateProperty("AddressType", value);
                    this._addressType = value;
                    this.RaiseDataMemberChanged("AddressType");
                    this.OnAddressTypeChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the associated <see cref="Customer"/> entity.
        /// </summary>
        [Association("Customer_CustomerAddress", "CustomerID", "CustomerID", IsForeignKey=true)]
        [XmlIgnore()]
        public Customer Customer
        {
            get
            {
                if ((this._customer == null))
                {
                    this._customer = new EntityRef<Customer>(this, "Customer", this.FilterCustomer);
                }
                return this._customer.Entity;
            }
            set
            {
                Customer previous = this.Customer;
                if ((previous != value))
                {
                    this.ValidateProperty("Customer", value);
                    if ((previous != null))
                    {
                        this._customer.Entity = null;
                        previous.CustomerAddress.Remove(this);
                    }
                    if ((value != null))
                    {
                        this.CustomerID = value.CustomerID;
                    }
                    else
                    {
                        this.CustomerID = default(int);
                    }
                    this._customer.Entity = value;
                    if ((value != null))
                    {
                        value.CustomerAddress.Add(this);
                    }
                    this.RaisePropertyChanged("Customer");
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'CustomerID' value.
        /// </summary>
        [DataMember()]
        [Key()]
        [RoundtripOriginal()]
        public int CustomerID
        {
            get
            {
                return this._customerID;
            }
            set
            {
                if ((this._customerID != value))
                {
                    this.OnCustomerIDChanging(value);
                    this.RaiseDataMemberChanging("CustomerID");
                    this.ValidateProperty("CustomerID", value);
                    this._customerID = value;
                    this.RaiseDataMemberChanged("CustomerID");
                    this.OnCustomerIDChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'ModifiedDate' value.
        /// </summary>
        [DataMember()]
        public DateTime ModifiedDate
        {
            get
            {
                return this._modifiedDate;
            }
            set
            {
                if ((this._modifiedDate != value))
                {
                    this.OnModifiedDateChanging(value);
                    this.RaiseDataMemberChanging("ModifiedDate");
                    this.ValidateProperty("ModifiedDate", value);
                    this._modifiedDate = value;
                    this.RaiseDataMemberChanged("ModifiedDate");
                    this.OnModifiedDateChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'rowguid' value.
        /// </summary>
        [DataMember()]
        public Guid rowguid
        {
            get
            {
                return this._rowguid;
            }
            set
            {
                if ((this._rowguid != value))
                {
                    this.OnrowguidChanging(value);
                    this.RaiseDataMemberChanging("rowguid");
                    this.ValidateProperty("rowguid", value);
                    this._rowguid = value;
                    this.RaiseDataMemberChanged("rowguid");
                    this.OnrowguidChanged();
                }
            }
        }
        
        private bool FilterAddress(Address entity)
        {
            return (entity.AddressID == this.AddressID);
        }
        
        private bool FilterCustomer(Customer entity)
        {
            return (entity.CustomerID == this.CustomerID);
        }
        
        /// <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._addressID, this._customerID);
        }
    }
    
    /// <summary>
    /// The 'ErrorLog' entity class.
    /// </summary>
    [DataContract(Namespace="http://schemas.datacontract.org/2004/07/ReportingServicesDemo.Web")]
    public sealed partial class ErrorLog : Entity
    {
        
        private Nullable<int> _errorLine;
        
        private int _errorLogID;
        
        private string _errorMessage;
        
        private int _errorNumber;
        
        private string _errorProcedure;
        
        private Nullable<int> _errorSeverity;
        
        private Nullable<int> _errorState;
        
        private DateTime _errorTime;
        
        private string _userName;
        
        #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 OnErrorLineChanging(Nullable<int> value);
        partial void OnErrorLineChanged();
        partial void OnErrorLogIDChanging(int value);
        partial void OnErrorLogIDChanged();
        partial void OnErrorMessageChanging(string value);
        partial void OnErrorMessageChanged();
        partial void OnErrorNumberChanging(int value);
        partial void OnErrorNumberChanged();
        partial void OnErrorProcedureChanging(string value);
        partial void OnErrorProcedureChanged();
        partial void OnErrorSeverityChanging(Nullable<int> value);
        partial void OnErrorSeverityChanged();
        partial void OnErrorStateChanging(Nullable<int> value);
        partial void OnErrorStateChanged();
        partial void OnErrorTimeChanging(DateTime value);
        partial void OnErrorTimeChanged();
        partial void OnUserNameChanging(string value);
        partial void OnUserNameChanged();

        #endregion
        
        
        /// <summary>
        /// Initializes a new instance of the <see cref="ErrorLog"/> class.
        /// </summary>
        public ErrorLog()
        {
            this.OnCreated();
        }
        
        /// <summary>
        /// Gets or sets the 'ErrorLine' value.
        /// </summary>
        [DataMember()]
        public Nullable<int> ErrorLine
        {
            get
            {
                return this._errorLine;
            }
            set
            {
                if ((this._errorLine != value))
                {
                    this.OnErrorLineChanging(value);
                    this.RaiseDataMemberChanging("ErrorLine");
                    this.ValidateProperty("ErrorLine", value);
                    this._errorLine = value;
                    this.RaiseDataMemberChanged("ErrorLine");
                    this.OnErrorLineChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'ErrorLogID' value.
        /// </summary>
        [DataMember()]
        [Editable(false, AllowInitialValue=true)]
        [Key()]
        [RoundtripOriginal()]
        public int ErrorLogID
        {
            get
            {
                return this._errorLogID;
            }
            set
            {
                if ((this._errorLogID != value))
                {
                    this.OnErrorLogIDChanging(value);
                    this.ValidateProperty("ErrorLogID", value);
                    this._errorLogID = value;
                    this.RaisePropertyChanged("ErrorLogID");
                    this.OnErrorLogIDChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'ErrorMessage' value.
        /// </summary>
        [DataMember()]
        [Required()]
        [StringLength(4000)]
        public string ErrorMessage
        {
            get
            {
                return this._errorMessage;
            }
            set
            {
                if ((this._errorMessage != value))
                {
                    this.OnErrorMessageChanging(value);
                    this.RaiseDataMemberChanging("ErrorMessage");
                    this.ValidateProperty("ErrorMessage", value);
                    this._errorMessage = value;
                    this.RaiseDataMemberChanged("ErrorMessage");
                    this.OnErrorMessageChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'ErrorNumber' value.
        /// </summary>
        [DataMember()]
        public int ErrorNumber
        {
            get
            {
                return this._errorNumber;
            }
            set
            {
                if ((this._errorNumber != value))
                {
                    this.OnErrorNumberChanging(value);
                    this.RaiseDataMemberChanging("ErrorNumber");
                    this.ValidateProperty("ErrorNumber", value);
                    this._errorNumber = value;
                    this.RaiseDataMemberChanged("ErrorNumber");
                    this.OnErrorNumberChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'ErrorProcedure' value.
        /// </summary>
        [DataMember()]
        [StringLength(126)]
        public string ErrorProcedure
        {
            get
            {
                return this._errorProcedure;
            }
            set
            {
                if ((this._errorProcedure != value))
                {
                    this.OnErrorProcedureChanging(value);
                    this.RaiseDataMemberChanging("ErrorProcedure");
                    this.ValidateProperty("ErrorProcedure", value);
                    this._errorProcedure = value;
                    this.RaiseDataMemberChanged("ErrorProcedure");
                    this.OnErrorProcedureChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'ErrorSeverity' value.
        /// </summary>
        [DataMember()]
        public Nullable<int> ErrorSeverity
        {
            get
            {
                return this._errorSeverity;
            }
            set
            {
                if ((this._errorSeverity != value))
                {
                    this.OnErrorSeverityChanging(value);
                    this.RaiseDataMemberChanging("ErrorSeverity");
                    this.ValidateProperty("ErrorSeverity", value);
                    this._errorSeverity = value;
                    this.RaiseDataMemberChanged("ErrorSeverity");
                    this.OnErrorSeverityChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'ErrorState' value.
        /// </summary>
        [DataMember()]
        public Nullable<int> ErrorState
        {
            get
            {
                return this._errorState;
            }
            set
            {
                if ((this._errorState != value))
                {
                    this.OnErrorStateChanging(value);
                    this.RaiseDataMemberChanging("ErrorState");
                    this.ValidateProperty("ErrorState", value);
                    this._errorState = value;
                    this.RaiseDataMemberChanged("ErrorState");
                    this.OnErrorStateChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'ErrorTime' value.
        /// </summary>
        [DataMember()]
        public DateTime ErrorTime
        {
            get
            {
                return this._errorTime;
            }
            set
            {
                if ((this._errorTime != value))
                {
                    this.OnErrorTimeChanging(value);
                    this.RaiseDataMemberChanging("ErrorTime");
                    this.ValidateProperty("ErrorTime", value);
                    this._errorTime = value;
                    this.RaiseDataMemberChanged("ErrorTime");
                    this.OnErrorTimeChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'UserName' value.
        /// </summary>
        [DataMember()]
        [Required()]
        [StringLength(128)]
        public string UserName
        {
            get
            {
                return this._userName;
            }
            set
            {
                if ((this._userName != value))
                {
                    this.OnUserNameChanging(value);
                    this.RaiseDataMemberChanging("UserName");
                    this.ValidateProperty("UserName", value);
                    this._userName = value;
                    this.RaiseDataMemberChanged("UserName");
                    this.OnUserNameChanged();
                }
            }
        }
        
        /// <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 this._errorLogID;
        }
    }
    
    /// <summary>
    /// The 'Orders' entity class.
    /// </summary>
    [DataContract(Namespace="http://schemas.datacontract.org/2004/07/ReportingServicesDemo.Web")]
    public sealed partial class Orders : Entity
    {
        
        private decimal _lineTotal;
        
        private int _orderDetailsID;
        
        private int _orderID;
        
        private string _product;
        
        private int _quantity;
        
        private decimal _unitPrice;
        
        private decimal _unitPriceDiscount;
        
        #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 OnLineTotalChanging(decimal value);
        partial void OnLineTotalChanged();
        partial void OnOrderDetailsIDChanging(int value);
        partial void OnOrderDetailsIDChanged();
        partial void OnOrderIDChanging(int value);
        partial void OnOrderIDChanged();
        partial void OnProductChanging(string value);
        partial void OnProductChanged();
        partial void OnQuantityChanging(int value);
        partial void OnQuantityChanged();
        partial void OnUnitPriceChanging(decimal value);
        partial void OnUnitPriceChanged();
        partial void OnUnitPriceDiscountChanging(decimal value);
        partial void OnUnitPriceDiscountChanged();

        #endregion
        
        
        /// <summary>
        /// Initializes a new instance of the <see cref="Orders"/> class.
        /// </summary>
        public Orders()
        {
            this.OnCreated();
        }
        
        /// <summary>
        /// Gets or sets the 'LineTotal' value.
        /// </summary>
        [DataMember()]
        public decimal LineTotal
        {
            get
            {
                return this._lineTotal;
            }
            set
            {
                if ((this._lineTotal != value))
                {
                    this.OnLineTotalChanging(value);
                    this.RaiseDataMemberChanging("LineTotal");
                    this.ValidateProperty("LineTotal", value);
                    this._lineTotal = value;
                    this.RaiseDataMemberChanged("LineTotal");
                    this.OnLineTotalChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'OrderDetailsID' value.
        /// </summary>
        [DataMember()]
        [Editable(false, AllowInitialValue=true)]
        [Key()]
        [RoundtripOriginal()]
        public int OrderDetailsID
        {
            get
            {
                return this._orderDetailsID;
            }
            set
            {
                if ((this._orderDetailsID != value))
                {
                    this.OnOrderDetailsIDChanging(value);
                    this.ValidateProperty("OrderDetailsID", value);
                    this._orderDetailsID = value;
                    this.RaisePropertyChanged("OrderDetailsID");
                    this.OnOrderDetailsIDChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'OrderID' value.
        /// </summary>
        [DataMember()]
        public int OrderID
        {
            get
            {
                return this._orderID;
            }
            set
            {
                if ((this._orderID != value))
                {
                    this.OnOrderIDChanging(value);
                    this.RaiseDataMemberChanging("OrderID");
                    this.ValidateProperty("OrderID", value);
                    this._orderID = value;
                    this.RaiseDataMemberChanged("OrderID");
                    this.OnOrderIDChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'Product' value.
        /// </summary>
        [DataMember()]
        public string Product
        {
            get
            {
                return this._product;
            }
            set
            {
                if ((this._product != value))
                {
                    this.OnProductChanging(value);
                    this.RaiseDataMemberChanging("Product");
                    this.ValidateProperty("Product", value);
                    this._product = value;
                    this.RaiseDataMemberChanged("Product");
                    this.OnProductChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'Quantity' value.
        /// </summary>
        [DataMember()]
        public int Quantity
        {
            get
            {
                return this._quantity;
            }
            set
            {
                if ((this._quantity != value))
                {
                    this.OnQuantityChanging(value);
                    this.RaiseDataMemberChanging("Quantity");
                    this.ValidateProperty("Quantity", value);
                    this._quantity = value;
                    this.RaiseDataMemberChanged("Quantity");
                    this.OnQuantityChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'UnitPrice' value.
        /// </summary>
        [DataMember()]
        public decimal UnitPrice
        {
            get
            {
                return this._unitPrice;
            }
            set
            {
                if ((this._unitPrice != value))
                {
                    this.OnUnitPriceChanging(value);
                    this.RaiseDataMemberChanging("UnitPrice");
                    this.ValidateProperty("UnitPrice", value);
                    this._unitPrice = value;
                    this.RaiseDataMemberChanged("UnitPrice");
                    this.OnUnitPriceChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'UnitPriceDiscount' value.
        /// </summary>
        [DataMember()]
        public decimal UnitPriceDiscount
        {
            get
            {
                return this._unitPriceDiscount;
            }
            set
            {
                if ((this._unitPriceDiscount != value))
                {
                    this.OnUnitPriceDiscountChanging(value);
                    this.RaiseDataMemberChanging("UnitPriceDiscount");
                    this.ValidateProperty("UnitPriceDiscount", value);
                    this._unitPriceDiscount = value;
                    this.RaiseDataMemberChanged("UnitPriceDiscount");
                    this.OnUnitPriceDiscountChanged();
                }
            }
        }
        
        /// <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 this._orderDetailsID;
        }
    }
    
    /// <summary>
    /// The 'Product' entity class.
    /// </summary>
    [DataContract(Namespace="http://schemas.datacontract.org/2004/07/ReportingServicesDemo.Web")]
    public sealed partial class Product : Entity
    {
        
        private string _color;
        
        private Nullable<DateTime> _discontinuedDate;
        
        private decimal _listPrice;
        
        private DateTime _modifiedDate;
        
        private string _name;
        
        private EntityRef<ProductCategory> _productCategory;
        
        private Nullable<int> _productCategoryID;
        
        private int _productID;
        
        private EntityRef<ProductModel> _productModel;
        
        private Nullable<int> _productModelID;
        
        private string _productNumber;
        
        private Guid _rowguid;
        
        private EntityCollection<SalesOrderDetail> _salesOrderDetail;
        
        private Nullable<DateTime> _sellEndDate;
        
        private DateTime _sellStartDate;
        
        private string _size;
        
        private decimal _standardCost;
        
        private byte[] _thumbNailPhoto;
        
        private string _thumbnailPhotoFileName;
        
        private Nullable<decimal> _weight;
        
        #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 OnColorChanging(string value);
        partial void OnColorChanged();
        partial void OnDiscontinuedDateChanging(Nullable<DateTime> value);
        partial void OnDiscontinuedDateChanged();
        partial void OnListPriceChanging(decimal value);
        partial void OnListPriceChanged();
        partial void OnModifiedDateChanging(DateTime value);
        partial void OnModifiedDateChanged();
        partial void OnNameChanging(string value);
        partial void OnNameChanged();
        partial void OnProductCategoryIDChanging(Nullable<int> value);
        partial void OnProductCategoryIDChanged();
        partial void OnProductIDChanging(int value);
        partial void OnProductIDChanged();
        partial void OnProductModelIDChanging(Nullable<int> value);
        partial void OnProductModelIDChanged();
        partial void OnProductNumberChanging(string value);
        partial void OnProductNumberChanged();
        partial void OnrowguidChanging(Guid value);
        partial void OnrowguidChanged();
        partial void OnSellEndDateChanging(Nullable<DateTime> value);
        partial void OnSellEndDateChanged();
        partial void OnSellStartDateChanging(DateTime value);
        partial void OnSellStartDateChanged();
        partial void OnSizeChanging(string value);
        partial void OnSizeChanged();
        partial void OnStandardCostChanging(decimal value);
        partial void OnStandardCostChanged();
        partial void OnThumbNailPhotoChanging(byte[] value);
        partial void OnThumbNailPhotoChanged();
        partial void OnThumbnailPhotoFileNameChanging(string value);
        partial void OnThumbnailPhotoFileNameChanged();
        partial void OnWeightChanging(Nullable<decimal> value);
        partial void OnWeightChanged();

        #endregion
        
        
        /// <summary>
        /// Initializes a new instance of the <see cref="Product"/> class.
        /// </summary>
        public Product()
        {
            this.OnCreated();
        }
        
        /// <summary>
        /// Gets or sets the 'Color' value.
        /// </summary>
        [DataMember()]
        [StringLength(15)]
        public string Color
        {
            get
            {
                return this._color;
            }
            set
            {
                if ((this._color != value))
                {
                    this.OnColorChanging(value);
                    this.RaiseDataMemberChanging("Color");
                    this.ValidateProperty("Color", value);
                    this._color = value;
                    this.RaiseDataMemberChanged("Color");
                    this.OnColorChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'DiscontinuedDate' value.
        /// </summary>
        [DataMember()]
        public Nullable<DateTime> DiscontinuedDate
        {
            get
            {
                return this._discontinuedDate;
            }
            set
            {
                if ((this._discontinuedDate != value))
                {
                    this.OnDiscontinuedDateChanging(value);
                    this.RaiseDataMemberChanging("DiscontinuedDate");
                    this.ValidateProperty("DiscontinuedDate", value);
                    this._discontinuedDate = value;
                    this.RaiseDataMemberChanged("DiscontinuedDate");
                    this.OnDiscontinuedDateChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'ListPrice' value.
        /// </summary>
        [DataMember()]
        public decimal ListPrice
        {
            get
            {
                return this._listPrice;
            }
            set
            {
                if ((this._listPrice != value))
                {
                    this.OnListPriceChanging(value);
                    this.RaiseDataMemberChanging("ListPrice");
                    this.ValidateProperty("ListPrice", value);
                    this._listPrice = value;
                    this.RaiseDataMemberChanged("ListPrice");
                    this.OnListPriceChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'ModifiedDate' value.
        /// </summary>
        [DataMember()]
        public DateTime ModifiedDate
        {
            get
            {
                return this._modifiedDate;
            }
            set
            {
                if ((this._modifiedDate != value))
                {
                    this.OnModifiedDateChanging(value);
                    this.RaiseDataMemberChanging("ModifiedDate");
                    this.ValidateProperty("ModifiedDate", value);
                    this._modifiedDate = value;
                    this.RaiseDataMemberChanged("ModifiedDate");
                    this.OnModifiedDateChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'Name' value.
        /// </summary>
        [DataMember()]
        [Required()]
        [StringLength(50)]
        public string Name
        {
            get
            {
                return this._name;
            }
            set
            {
                if ((this._name != value))
                {
                    this.OnNameChanging(value);
                    this.RaiseDataMemberChanging("Name");
                    this.ValidateProperty("Name", value);
                    this._name = value;
                    this.RaiseDataMemberChanged("Name");
                    this.OnNameChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the associated <see cref="ProductCategory"/> entity.
        /// </summary>
        [Association("ProductCategory_Product", "ProductCategoryID", "ProductCategoryID", IsForeignKey=true)]
        [XmlIgnore()]
        public ProductCategory ProductCategory
        {
            get
            {
                if ((this._productCategory == null))
                {
                    this._productCategory = new EntityRef<ProductCategory>(this, "ProductCategory", this.FilterProductCategory);
                }
                return this._productCategory.Entity;
            }
            set
            {
                ProductCategory previous = this.ProductCategory;
                if ((previous != value))
                {
                    this.ValidateProperty("ProductCategory", value);
                    if ((previous != null))
                    {
                        this._productCategory.Entity = null;
                        previous.Product.Remove(this);
                    }
                    if ((value != null))
                    {
                        this.ProductCategoryID = value.ProductCategoryID;
                    }
                    else
                    {
                        this.ProductCategoryID = default(Nullable<int>);
                    }
                    this._productCategory.Entity = value;
                    if ((value != null))
                    {
                        value.Product.Add(this);
                    }
                    this.RaisePropertyChanged("ProductCategory");
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'ProductCategoryID' value.
        /// </summary>
        [DataMember()]
        [RoundtripOriginal()]
        public Nullable<int> ProductCategoryID
        {
            get
            {
                return this._productCategoryID;
            }
            set
            {
                if ((this._productCategoryID != value))
                {
                    this.OnProductCategoryIDChanging(value);
                    this.RaiseDataMemberChanging("ProductCategoryID");
                    this.ValidateProperty("ProductCategoryID", value);
                    this._productCategoryID = value;
                    this.RaiseDataMemberChanged("ProductCategoryID");
                    this.OnProductCategoryIDChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'ProductID' value.
        /// </summary>
        [DataMember()]
        [Editable(false, AllowInitialValue=true)]
        [Key()]
        [RoundtripOriginal()]
        public int ProductID
        {
            get
            {
                return this._productID;
            }
            set
            {
                if ((this._productID != value))
                {
                    this.OnProductIDChanging(value);
                    this.ValidateProperty("ProductID", value);
                    this._productID = value;
                    this.RaisePropertyChanged("ProductID");
                    this.OnProductIDChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the associated <see cref="ProductModel"/> entity.
        /// </summary>
        [Association("ProductModel_Product", "ProductModelID", "ProductModelID", IsForeignKey=true)]
        [XmlIgnore()]
        public ProductModel ProductModel
        {
            get
            {
                if ((this._productModel == null))
                {
                    this._productModel = new EntityRef<ProductModel>(this, "ProductModel", this.FilterProductModel);
                }
                return this._productModel.Entity;
            }
            set
            {
                ProductModel previous = this.ProductModel;
                if ((previous != value))
                {
                    this.ValidateProperty("ProductModel", value);
                    if ((previous != null))
                    {
                        this._productModel.Entity = null;
                        previous.Product.Remove(this);
                    }
                    if ((value != null))
                    {
                        this.ProductModelID = value.ProductModelID;
                    }
                    else
                    {
                        this.ProductModelID = default(Nullable<int>);
                    }
                    this._productModel.Entity = value;
                    if ((value != null))
                    {
                        value.Product.Add(this);
                    }
                    this.RaisePropertyChanged("ProductModel");
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'ProductModelID' value.
        /// </summary>
        [DataMember()]
        [RoundtripOriginal()]
        public Nullable<int> ProductModelID
        {
            get
            {
                return this._productModelID;
            }
            set
            {
                if ((this._productModelID != value))
                {
                    this.OnProductModelIDChanging(value);
                    this.RaiseDataMemberChanging("ProductModelID");
                    this.ValidateProperty("ProductModelID", value);
                    this._productModelID = value;
                    this.RaiseDataMemberChanged("ProductModelID");
                    this.OnProductModelIDChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'ProductNumber' value.
        /// </summary>
        [DataMember()]
        [Required()]
        [StringLength(25)]
        public string ProductNumber
        {
            get
            {
                return this._productNumber;
            }
            set
            {
                if ((this._productNumber != value))
                {
                    this.OnProductNumberChanging(value);
                    this.RaiseDataMemberChanging("ProductNumber");
                    this.ValidateProperty("ProductNumber", value);
                    this._productNumber = value;
                    this.RaiseDataMemberChanged("ProductNumber");
                    this.OnProductNumberChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'rowguid' value.
        /// </summary>
        [DataMember()]
        public Guid rowguid
        {
            get
            {
                return this._rowguid;
            }
            set
            {
                if ((this._rowguid != value))
                {
                    this.OnrowguidChanging(value);
                    this.RaiseDataMemberChanging("rowguid");
                    this.ValidateProperty("rowguid", value);
                    this._rowguid = value;
                    this.RaiseDataMemberChanged("rowguid");
                    this.OnrowguidChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets the collection of associated <see cref="SalesOrderDetail"/> entities.
        /// </summary>
        [Association("Product_SalesOrderDetail", "ProductID", "ProductID")]
        [XmlIgnore()]
        public EntityCollection<SalesOrderDetail> SalesOrderDetail
        {
            get
            {
                if ((this._salesOrderDetail == null))
                {
                    this._salesOrderDetail = new EntityCollection<SalesOrderDetail>(this, "SalesOrderDetail", this.FilterSalesOrderDetail, this.AttachSalesOrderDetail, this.DetachSalesOrderDetail);
                }
                return this._salesOrderDetail;
            }
        }
        
        /// <summary>
        /// Gets or sets the 'SellEndDate' value.
        /// </summary>
        [DataMember()]
        public Nullable<DateTime> SellEndDate
        {
            get
            {
                return this._sellEndDate;
            }
            set
            {
                if ((this._sellEndDate != value))
                {
                    this.OnSellEndDateChanging(value);
                    this.RaiseDataMemberChanging("SellEndDate");
                    this.ValidateProperty("SellEndDate", value);
                    this._sellEndDate = value;
                    this.RaiseDataMemberChanged("SellEndDate");
                    this.OnSellEndDateChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'SellStartDate' value.
        /// </summary>
        [DataMember()]
        public DateTime SellStartDate
        {
            get
            {
                return this._sellStartDate;
            }
            set
            {
                if ((this._sellStartDate != value))
                {
                    this.OnSellStartDateChanging(value);
                    this.RaiseDataMemberChanging("SellStartDate");
                    this.ValidateProperty("SellStartDate", value);
                    this._sellStartDate = value;
                    this.RaiseDataMemberChanged("SellStartDate");
                    this.OnSellStartDateChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'Size' value.
        /// </summary>
        [DataMember()]
        [StringLength(5)]
        public string Size
        {
            get
            {
                return this._size;
            }
            set
            {
                if ((this._size != value))
                {
                    this.OnSizeChanging(value);
                    this.RaiseDataMemberChanging("Size");
                    this.ValidateProperty("Size", value);
                    this._size = value;
                    this.RaiseDataMemberChanged("Size");
                    this.OnSizeChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'StandardCost' value.
        /// </summary>
        [DataMember()]
        public decimal StandardCost
        {
            get
            {
                return this._standardCost;
            }
            set
            {
                if ((this._standardCost != value))
                {
                    this.OnStandardCostChanging(value);
                    this.RaiseDataMemberChanging("StandardCost");
                    this.ValidateProperty("StandardCost", value);
                    this._standardCost = value;
                    this.RaiseDataMemberChanged("StandardCost");
                    this.OnStandardCostChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'ThumbNailPhoto' value.
        /// </summary>
        [DataMember()]
        public byte[] ThumbNailPhoto
        {
            get
            {
                return this._thumbNailPhoto;
            }
            set
            {
                if ((this._thumbNailPhoto != value))
                {
                    this.OnThumbNailPhotoChanging(value);
                    this.RaiseDataMemberChanging("ThumbNailPhoto");
                    this.ValidateProperty("ThumbNailPhoto", value);
                    this._thumbNailPhoto = value;
                    this.RaiseDataMemberChanged("ThumbNailPhoto");
                    this.OnThumbNailPhotoChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'ThumbnailPhotoFileName' value.
        /// </summary>
        [DataMember()]
        [StringLength(50)]
        public string ThumbnailPhotoFileName
        {
            get
            {
                return this._thumbnailPhotoFileName;
            }
            set
            {
                if ((this._thumbnailPhotoFileName != value))
                {
                    this.OnThumbnailPhotoFileNameChanging(value);
                    this.RaiseDataMemberChanging("ThumbnailPhotoFileName");
                    this.ValidateProperty("ThumbnailPhotoFileName", value);
                    this._thumbnailPhotoFileName = value;
                    this.RaiseDataMemberChanged("ThumbnailPhotoFileName");
                    this.OnThumbnailPhotoFileNameChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'Weight' value.
        /// </summary>
        [DataMember()]
        public Nullable<decimal> Weight
        {
            get
            {
                return this._weight;
            }
            set
            {
                if ((this._weight != value))
                {
                    this.OnWeightChanging(value);
                    this.RaiseDataMemberChanging("Weight");
                    this.ValidateProperty("Weight", value);
                    this._weight = value;
                    this.RaiseDataMemberChanged("Weight");
                    this.OnWeightChanged();
                }
            }
        }
        
        private bool FilterProductCategory(ProductCategory entity)
        {
            return (entity.ProductCategoryID == this.ProductCategoryID);
        }
        
        private bool FilterProductModel(ProductModel entity)
        {
            return (entity.ProductModelID == this.ProductModelID);
        }
        
        private void AttachSalesOrderDetail(SalesOrderDetail entity)
        {
            entity.Product = this;
        }
        
        private void DetachSalesOrderDetail(SalesOrderDetail entity)
        {
            entity.Product = null;
        }
        
        private bool FilterSalesOrderDetail(SalesOrderDetail entity)
        {
            return (entity.ProductID == this.ProductID);
        }
        
        /// <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 this._productID;
        }
    }
    
    /// <summary>
    /// The 'ProductCategory' entity class.
    /// </summary>
    [DataContract(Namespace="http://schemas.datacontract.org/2004/07/ReportingServicesDemo.Web")]
    public sealed partial class ProductCategory : Entity
    {
        
        private DateTime _modifiedDate;
        
        private string _name;
        
        private Nullable<int> _parentProductCategoryID;
        
        private EntityCollection<Product> _product;
        
        private EntityCollection<ProductCategory> _productCategory1;
        
        private EntityRef<ProductCategory> _productCategory2;
        
        private int _productCategoryID;
        
        private Guid _rowguid;
        
        #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 OnModifiedDateChanging(DateTime value);
        partial void OnModifiedDateChanged();
        partial void OnNameChanging(string value);
        partial void OnNameChanged();
        partial void OnParentProductCategoryIDChanging(Nullable<int> value);
        partial void OnParentProductCategoryIDChanged();
        partial void OnProductCategoryIDChanging(int value);
        partial void OnProductCategoryIDChanged();
        partial void OnrowguidChanging(Guid value);
        partial void OnrowguidChanged();

        #endregion
        
        
        /// <summary>
        /// Initializes a new instance of the <see cref="ProductCategory"/> class.
        /// </summary>
        public ProductCategory()
        {
            this.OnCreated();
        }
        
        /// <summary>
        /// Gets or sets the 'ModifiedDate' value.
        /// </summary>
        [DataMember()]
        public DateTime ModifiedDate
        {
            get
            {
                return this._modifiedDate;
            }
            set
            {
                if ((this._modifiedDate != value))
                {
                    this.OnModifiedDateChanging(value);
                    this.RaiseDataMemberChanging("ModifiedDate");
                    this.ValidateProperty("ModifiedDate", value);
                    this._modifiedDate = value;
                    this.RaiseDataMemberChanged("ModifiedDate");
                    this.OnModifiedDateChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'Name' value.
        /// </summary>
        [DataMember()]
        [Required()]
        [StringLength(50)]
        public string Name
        {
            get
            {
                return this._name;
            }
            set
            {
                if ((this._name != value))
                {
                    this.OnNameChanging(value);
                    this.RaiseDataMemberChanging("Name");
                    this.ValidateProperty("Name", value);
                    this._name = value;
                    this.RaiseDataMemberChanged("Name");
                    this.OnNameChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'ParentProductCategoryID' value.
        /// </summary>
        [DataMember()]
        [RoundtripOriginal()]
        public Nullable<int> ParentProductCategoryID
        {
            get
            {
                return this._parentProductCategoryID;
            }
            set
            {
                if ((this._parentProductCategoryID != value))
                {
                    this.OnParentProductCategoryIDChanging(value);
                    this.RaiseDataMemberChanging("ParentProductCategoryID");
                    this.ValidateProperty("ParentProductCategoryID", value);
                    this._parentProductCategoryID = value;
                    this.RaiseDataMemberChanged("ParentProductCategoryID");
                    this.OnParentProductCategoryIDChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets the collection of associated <see cref="Product"/> entities.
        /// </summary>
        [Association("ProductCategory_Product", "ProductCategoryID", "ProductCategoryID")]
        [XmlIgnore()]
        public EntityCollection<Product> Product
        {
            get
            {
                if ((this._product == null))
                {
                    this._product = new EntityCollection<Product>(this, "Product", this.FilterProduct, this.AttachProduct, this.DetachProduct);
                }
                return this._product;
            }
        }
        
        /// <summary>
        /// Gets the collection of associated <see cref="ProductCategory"/> entities.
        /// </summary>
        [Association("ProductCategory_ProductCategory", "ProductCategoryID", "ParentProductCategoryID")]
        [XmlIgnore()]
        public EntityCollection<ProductCategory> ProductCategory1
        {
            get
            {
                if ((this._productCategory1 == null))
                {
                    this._productCategory1 = new EntityCollection<ProductCategory>(this, "ProductCategory1", this.FilterProductCategory1, this.AttachProductCategory1, this.DetachProductCategory1);
                }
                return this._productCategory1;
            }
        }
        
        /// <summary>
        /// Gets or sets the associated <see cref="ProductCategory"/> entity.
        /// </summary>
        [Association("ProductCategory_ProductCategory", "ParentProductCategoryID", "ProductCategoryID", IsForeignKey=true)]
        [XmlIgnore()]
        public ProductCategory ProductCategory2
        {
            get
            {
                if ((this._productCategory2 == null))
                {
                    this._productCategory2 = new EntityRef<ProductCategory>(this, "ProductCategory2", this.FilterProductCategory2);
                }
                return this._productCategory2.Entity;
            }
            set
            {
                ProductCategory previous = this.ProductCategory2;
                if ((previous != value))
                {
                    this.ValidateProperty("ProductCategory2", value);
                    if ((previous != null))
                    {
                        this._productCategory2.Entity = null;
                        previous.ProductCategory1.Remove(this);
                    }
                    if ((value != null))
                    {
                        this.ParentProductCategoryID = value.ProductCategoryID;
                    }
                    else
                    {
                        this.ParentProductCategoryID = default(Nullable<int>);
                    }
                    this._productCategory2.Entity = value;
                    if ((value != null))
                    {
                        value.ProductCategory1.Add(this);
                    }
                    this.RaisePropertyChanged("ProductCategory2");
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'ProductCategoryID' value.
        /// </summary>
        [DataMember()]
        [Editable(false, AllowInitialValue=true)]
        [Key()]
        [RoundtripOriginal()]
        public int ProductCategoryID
        {
            get
            {
                return this._productCategoryID;
            }
            set
            {
                if ((this._productCategoryID != value))
                {
                    this.OnProductCategoryIDChanging(value);
                    this.ValidateProperty("ProductCategoryID", value);
                    this._productCategoryID = value;
                    this.RaisePropertyChanged("ProductCategoryID");
                    this.OnProductCategoryIDChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'rowguid' value.
        /// </summary>
        [DataMember()]
        public Guid rowguid
        {
            get
            {
                return this._rowguid;
            }
            set
            {
                if ((this._rowguid != value))
                {
                    this.OnrowguidChanging(value);
                    this.RaiseDataMemberChanging("rowguid");
                    this.ValidateProperty("rowguid", value);
                    this._rowguid = value;
                    this.RaiseDataMemberChanged("rowguid");
                    this.OnrowguidChanged();
                }
            }
        }
        
        private void AttachProduct(Product entity)
        {
            entity.ProductCategory = this;
        }
        
        private void DetachProduct(Product entity)
        {
            entity.ProductCategory = null;
        }
        
        private bool FilterProduct(Product entity)
        {
            return (entity.ProductCategoryID == this.ProductCategoryID);
        }
        
        private void AttachProductCategory1(ProductCategory entity)
        {
            entity.ProductCategory2 = this;
        }
        
        private void DetachProductCategory1(ProductCategory entity)
        {
            entity.ProductCategory2 = null;
        }
        
        private bool FilterProductCategory1(ProductCategory entity)
        {
            return (entity.ParentProductCategoryID == this.ProductCategoryID);
        }
        
        private bool FilterProductCategory2(ProductCategory entity)
        {
            return (entity.ProductCategoryID == this.ParentProductCategoryID);
        }
        
        /// <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 this._productCategoryID;
        }
    }
    
    /// <summary>
    /// The 'ProductDescription' entity class.
    /// </summary>
    [DataContract(Namespace="http://schemas.datacontract.org/2004/07/ReportingServicesDemo.Web")]
    public sealed partial class ProductDescription : Entity
    {
        
        private string _description;
        
        private DateTime _modifiedDate;
        
        private int _productDescriptionID;
        
        private EntityCollection<ProductModelProductDescription> _productModelProductDescription;
        
        private Guid _rowguid;
        
        #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 OnDescriptionChanging(string value);
        partial void OnDescriptionChanged();
        partial void OnModifiedDateChanging(DateTime value);
        partial void OnModifiedDateChanged();
        partial void OnProductDescriptionIDChanging(int value);
        partial void OnProductDescriptionIDChanged();
        partial void OnrowguidChanging(Guid value);
        partial void OnrowguidChanged();

        #endregion
        
        
        /// <summary>
        /// Initializes a new instance of the <see cref="ProductDescription"/> class.
        /// </summary>
        public ProductDescription()
        {
            this.OnCreated();
        }
        
        /// <summary>
        /// Gets or sets the 'Description' value.
        /// </summary>
        [DataMember()]
        [Required()]
        [StringLength(400)]
        public string Description
        {
            get
            {
                return this._description;
            }
            set
            {
                if ((this._description != value))
                {
                    this.OnDescriptionChanging(value);
                    this.RaiseDataMemberChanging("Description");
                    this.ValidateProperty("Description", value);
                    this._description = value;
                    this.RaiseDataMemberChanged("Description");
                    this.OnDescriptionChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'ModifiedDate' value.
        /// </summary>
        [DataMember()]
        public DateTime ModifiedDate
        {
            get
            {
                return this._modifiedDate;
            }
            set
            {
                if ((this._modifiedDate != value))
                {
                    this.OnModifiedDateChanging(value);
                    this.RaiseDataMemberChanging("ModifiedDate");
                    this.ValidateProperty("ModifiedDate", value);
                    this._modifiedDate = value;
                    this.RaiseDataMemberChanged("ModifiedDate");
                    this.OnModifiedDateChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'ProductDescriptionID' value.
        /// </summary>
        [DataMember()]
        [Editable(false, AllowInitialValue=true)]
        [Key()]
        [RoundtripOriginal()]
        public int ProductDescriptionID
        {
            get
            {
                return this._productDescriptionID;
            }
            set
            {
                if ((this._productDescriptionID != value))
                {
                    this.OnProductDescriptionIDChanging(value);
                    this.ValidateProperty("ProductDescriptionID", value);
                    this._productDescriptionID = value;
                    this.RaisePropertyChanged("ProductDescriptionID");
                    this.OnProductDescriptionIDChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets the collection of associated <see cref="ProductModelProductDescription"/> entities.
        /// </summary>
        [Association("ProductDescription_ProductModelProductDescription", "ProductDescriptionID", "ProductDescriptionID")]
        [XmlIgnore()]
        public EntityCollection<ProductModelProductDescription> ProductModelProductDescription
        {
            get
            {
                if ((this._productModelProductDescription == null))
                {
                    this._productModelProductDescription = new EntityCollection<ProductModelProductDescription>(this, "ProductModelProductDescription", this.FilterProductModelProductDescription, this.AttachProductModelProductDescription, this.DetachProductModelProductDescription);
                }
                return this._productModelProductDescription;
            }
        }
        
        /// <summary>
        /// Gets or sets the 'rowguid' value.
        /// </summary>
        [DataMember()]
        public Guid rowguid
        {
            get
            {
                return this._rowguid;
            }
            set
            {
                if ((this._rowguid != value))
                {
                    this.OnrowguidChanging(value);
                    this.RaiseDataMemberChanging("rowguid");
                    this.ValidateProperty("rowguid", value);
                    this._rowguid = value;
                    this.RaiseDataMemberChanged("rowguid");
                    this.OnrowguidChanged();
                }
            }
        }
        
        private void AttachProductModelProductDescription(ProductModelProductDescription entity)
        {
            entity.ProductDescription = this;
        }
        
        private void DetachProductModelProductDescription(ProductModelProductDescription entity)
        {
            entity.ProductDescription = null;
        }
        
        private bool FilterProductModelProductDescription(ProductModelProductDescription entity)
        {
            return (entity.ProductDescriptionID == this.ProductDescriptionID);
        }
        
        /// <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 this._productDescriptionID;
        }
    }
    
    /// <summary>
    /// The 'ProductModel' entity class.
    /// </summary>
    [DataContract(Namespace="http://schemas.datacontract.org/2004/07/ReportingServicesDemo.Web")]
    public sealed partial class ProductModel : Entity
    {
        
        private string _catalogDescription;
        
        private DateTime _modifiedDate;
        
        private string _name;
        
        private EntityCollection<Product> _product;
        
        private int _productModelID;
        
        private EntityCollection<ProductModelProductDescription> _productModelProductDescription;
        
        private Guid _rowguid;
        
        #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 OnCatalogDescriptionChanging(string value);
        partial void OnCatalogDescriptionChanged();
        partial void OnModifiedDateChanging(DateTime value);
        partial void OnModifiedDateChanged();
        partial void OnNameChanging(string value);
        partial void OnNameChanged();
        partial void OnProductModelIDChanging(int value);
        partial void OnProductModelIDChanged();
        partial void OnrowguidChanging(Guid value);
        partial void OnrowguidChanged();

        #endregion
        
        
        /// <summary>
        /// Initializes a new instance of the <see cref="ProductModel"/> class.
        /// </summary>
        public ProductModel()
        {
            this.OnCreated();
        }
        
        /// <summary>
        /// Gets or sets the 'CatalogDescription' value.
        /// </summary>
        [DataMember()]
        public string CatalogDescription
        {
            get
            {
                return this._catalogDescription;
            }
            set
            {
                if ((this._catalogDescription != value))
                {
                    this.OnCatalogDescriptionChanging(value);
                    this.RaiseDataMemberChanging("CatalogDescription");
                    this.ValidateProperty("CatalogDescription", value);
                    this._catalogDescription = value;
                    this.RaiseDataMemberChanged("CatalogDescription");
                    this.OnCatalogDescriptionChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'ModifiedDate' value.
        /// </summary>
        [DataMember()]
        public DateTime ModifiedDate
        {
            get
            {
                return this._modifiedDate;
            }
            set
            {
                if ((this._modifiedDate != value))
                {
                    this.OnModifiedDateChanging(value);
                    this.RaiseDataMemberChanging("ModifiedDate");
                    this.ValidateProperty("ModifiedDate", value);
                    this._modifiedDate = value;
                    this.RaiseDataMemberChanged("ModifiedDate");
                    this.OnModifiedDateChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'Name' value.
        /// </summary>
        [DataMember()]
        [Required()]
        [StringLength(50)]
        public string Name
        {
            get
            {
                return this._name;
            }
            set
            {
                if ((this._name != value))
                {
                    this.OnNameChanging(value);
                    this.RaiseDataMemberChanging("Name");
                    this.ValidateProperty("Name", value);
                    this._name = value;
                    this.RaiseDataMemberChanged("Name");
                    this.OnNameChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets the collection of associated <see cref="Product"/> entities.
        /// </summary>
        [Association("ProductModel_Product", "ProductModelID", "ProductModelID")]
        [XmlIgnore()]
        public EntityCollection<Product> Product
        {
            get
            {
                if ((this._product == null))
                {
                    this._product = new EntityCollection<Product>(this, "Product", this.FilterProduct, this.AttachProduct, this.DetachProduct);
                }
                return this._product;
            }
        }
        
        /// <summary>
        /// Gets or sets the 'ProductModelID' value.
        /// </summary>
        [DataMember()]
        [Editable(false, AllowInitialValue=true)]
        [Key()]
        [RoundtripOriginal()]
        public int ProductModelID
        {
            get
            {
                return this._productModelID;
            }
            set
            {
                if ((this._productModelID != value))
                {
                    this.OnProductModelIDChanging(value);
                    this.ValidateProperty("ProductModelID", value);
                    this._productModelID = value;
                    this.RaisePropertyChanged("ProductModelID");
                    this.OnProductModelIDChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets the collection of associated <see cref="ProductModelProductDescription"/> entities.
        /// </summary>
        [Association("ProductModel_ProductModelProductDescription", "ProductModelID", "ProductModelID")]
        [XmlIgnore()]
        public EntityCollection<ProductModelProductDescription> ProductModelProductDescription
        {
            get
            {
                if ((this._productModelProductDescription == null))
                {
                    this._productModelProductDescription = new EntityCollection<ProductModelProductDescription>(this, "ProductModelProductDescription", this.FilterProductModelProductDescription, this.AttachProductModelProductDescription, this.DetachProductModelProductDescription);
                }
                return this._productModelProductDescription;
            }
        }
        
        /// <summary>
        /// Gets or sets the 'rowguid' value.
        /// </summary>
        [DataMember()]
        public Guid rowguid
        {
            get
            {
                return this._rowguid;
            }
            set
            {
                if ((this._rowguid != value))
                {
                    this.OnrowguidChanging(value);
                    this.RaiseDataMemberChanging("rowguid");
                    this.ValidateProperty("rowguid", value);
                    this._rowguid = value;
                    this.RaiseDataMemberChanged("rowguid");
                    this.OnrowguidChanged();
                }
            }
        }
        
        private void AttachProduct(Product entity)
        {
            entity.ProductModel = this;
        }
        
        private void DetachProduct(Product entity)
        {
            entity.ProductModel = null;
        }
        
        private bool FilterProduct(Product entity)
        {
            return (entity.ProductModelID == this.ProductModelID);
        }
        
        private void AttachProductModelProductDescription(ProductModelProductDescription entity)
        {
            entity.ProductModel = this;
        }
        
        private void DetachProductModelProductDescription(ProductModelProductDescription entity)
        {
            entity.ProductModel = null;
        }
        
        private bool FilterProductModelProductDescription(ProductModelProductDescription entity)
        {
            return (entity.ProductModelID == this.ProductModelID);
        }
        
        /// <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 this._productModelID;
        }
    }
    
    /// <summary>
    /// The 'ProductModelProductDescription' entity class.
    /// </summary>
    [DataContract(Namespace="http://schemas.datacontract.org/2004/07/ReportingServicesDemo.Web")]
    public sealed partial class ProductModelProductDescription : Entity
    {
        
        private string _culture;
        
        private DateTime _modifiedDate;
        
        private EntityRef<ProductDescription> _productDescription;
        
        private int _productDescriptionID;
        
        private EntityRef<ProductModel> _productModel;
        
        private int _productModelID;
        
        private Guid _rowguid;
        
        #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 OnCultureChanging(string value);
        partial void OnCultureChanged();
        partial void OnModifiedDateChanging(DateTime value);
        partial void OnModifiedDateChanged();
        partial void OnProductDescriptionIDChanging(int value);
        partial void OnProductDescriptionIDChanged();
        partial void OnProductModelIDChanging(int value);
        partial void OnProductModelIDChanged();
        partial void OnrowguidChanging(Guid value);
        partial void OnrowguidChanged();

        #endregion
        
        
        /// <summary>
        /// Initializes a new instance of the <see cref="ProductModelProductDescription"/> class.
        /// </summary>
        public ProductModelProductDescription()
        {
            this.OnCreated();
        }
        
        /// <summary>
        /// Gets or sets the 'Culture' value.
        /// </summary>
        [DataMember()]
        [Key()]
        [Required()]
        [RoundtripOriginal()]
        [StringLength(6)]
        public string Culture
        {
            get
            {
                return this._culture;
            }
            set
            {
                if ((this._culture != value))
                {
                    this.OnCultureChanging(value);
                    this.RaiseDataMemberChanging("Culture");
                    this.ValidateProperty("Culture", value);
                    this._culture = value;
                    this.RaiseDataMemberChanged("Culture");
                    this.OnCultureChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'ModifiedDate' value.
        /// </summary>
        [DataMember()]
        public DateTime ModifiedDate
        {
            get
            {
                return this._modifiedDate;
            }
            set
            {
                if ((this._modifiedDate != value))
                {
                    this.OnModifiedDateChanging(value);
                    this.RaiseDataMemberChanging("ModifiedDate");
                    this.ValidateProperty("ModifiedDate", value);
                    this._modifiedDate = value;
                    this.RaiseDataMemberChanged("ModifiedDate");
                    this.OnModifiedDateChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the associated <see cref="ProductDescription"/> entity.
        /// </summary>
        [Association("ProductDescription_ProductModelProductDescription", "ProductDescriptionID", "ProductDescriptionID", IsForeignKey=true)]
        [XmlIgnore()]
        public ProductDescription ProductDescription
        {
            get
            {
                if ((this._productDescription == null))
                {
                    this._productDescription = new EntityRef<ProductDescription>(this, "ProductDescription", this.FilterProductDescription);
                }
                return this._productDescription.Entity;
            }
            set
            {
                ProductDescription previous = this.ProductDescription;
                if ((previous != value))
                {
                    this.ValidateProperty("ProductDescription", value);
                    if ((previous != null))
                    {
                        this._productDescription.Entity = null;
                        previous.ProductModelProductDescription.Remove(this);
                    }
                    if ((value != null))
                    {
                        this.ProductDescriptionID = value.ProductDescriptionID;
                    }
                    else
                    {
                        this.ProductDescriptionID = default(int);
                    }
                    this._productDescription.Entity = value;
                    if ((value != null))
                    {
                        value.ProductModelProductDescription.Add(this);
                    }
                    this.RaisePropertyChanged("ProductDescription");
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'ProductDescriptionID' value.
        /// </summary>
        [DataMember()]
        [Key()]
        [RoundtripOriginal()]
        public int ProductDescriptionID
        {
            get
            {
                return this._productDescriptionID;
            }
            set
            {
                if ((this._productDescriptionID != value))
                {
                    this.OnProductDescriptionIDChanging(value);
                    this.RaiseDataMemberChanging("ProductDescriptionID");
                    this.ValidateProperty("ProductDescriptionID", value);
                    this._productDescriptionID = value;
                    this.RaiseDataMemberChanged("ProductDescriptionID");
                    this.OnProductDescriptionIDChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the associated <see cref="ProductModel"/> entity.
        /// </summary>
        [Association("ProductModel_ProductModelProductDescription", "ProductModelID", "ProductModelID", IsForeignKey=true)]
        [XmlIgnore()]
        public ProductModel ProductModel
        {
            get
            {
                if ((this._productModel == null))
                {
                    this._productModel = new EntityRef<ProductModel>(this, "ProductModel", this.FilterProductModel);
                }
                return this._productModel.Entity;
            }
            set
            {
                ProductModel previous = this.ProductModel;
                if ((previous != value))
                {
                    this.ValidateProperty("ProductModel", value);
                    if ((previous != null))
                    {
                        this._productModel.Entity = null;
                        previous.ProductModelProductDescription.Remove(this);
                    }
                    if ((value != null))
                    {
                        this.ProductModelID = value.ProductModelID;
                    }
                    else
                    {
                        this.ProductModelID = default(int);
                    }
                    this._productModel.Entity = value;
                    if ((value != null))
                    {
                        value.ProductModelProductDescription.Add(this);
                    }
                    this.RaisePropertyChanged("ProductModel");
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'ProductModelID' value.
        /// </summary>
        [DataMember()]
        [Key()]
        [RoundtripOriginal()]
        public int ProductModelID
        {
            get
            {
                return this._productModelID;
            }
            set
            {
                if ((this._productModelID != value))
                {
                    this.OnProductModelIDChanging(value);
                    this.RaiseDataMemberChanging("ProductModelID");
                    this.ValidateProperty("ProductModelID", value);
                    this._productModelID = value;
                    this.RaiseDataMemberChanged("ProductModelID");
                    this.OnProductModelIDChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'rowguid' value.
        /// </summary>
        [DataMember()]
        public Guid rowguid
        {
            get
            {
                return this._rowguid;
            }
            set
            {
                if ((this._rowguid != value))
                {
                    this.OnrowguidChanging(value);
                    this.RaiseDataMemberChanging("rowguid");
                    this.ValidateProperty("rowguid", value);
                    this._rowguid = value;
                    this.RaiseDataMemberChanged("rowguid");
                    this.OnrowguidChanged();
                }
            }
        }
        
        private bool FilterProductDescription(ProductDescription entity)
        {
            return (entity.ProductDescriptionID == this.ProductDescriptionID);
        }
        
        private bool FilterProductModel(ProductModel entity)
        {
            return (entity.ProductModelID == this.ProductModelID);
        }
        
        /// <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._culture, this._productDescriptionID, this._productModelID);
        }
    }
    
    /// <summary>
    /// The 'RegistrationData' entity class.
    /// </summary>
    [DataContract(Namespace="http://schemas.datacontract.org/2004/07/ReportingServicesDemo.Web")]
    public sealed partial class RegistrationData : Entity
    {
        
        private string _answer;
        
        private string _email;
        
        private string _friendlyName;
        
        private string _question;
        
        private string _userName;
        
        #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 OnAnswerChanging(string value);
        partial void OnAnswerChanged();
        partial void OnEmailChanging(string value);
        partial void OnEmailChanged();
        partial void OnFriendlyNameChanging(string value);
        partial void OnFriendlyNameChanged();
        partial void OnQuestionChanging(string value);
        partial void OnQuestionChanged();
        partial void OnUserNameChanging(string value);
        partial void OnUserNameChanged();

        #endregion
        
        
        /// <summary>
        /// Initializes a new instance of the <see cref="RegistrationData"/> class.
        /// </summary>
        public RegistrationData()
        {
            this.OnCreated();
        }
        
        /// <summary>
        /// Gets or sets the 'Answer' value.
        /// </summary>
        [DataMember()]
        [Display(Name="SecurityAnswerLabel", Order=6, ResourceType=typeof(RegistrationDataResources))]
        [Required(ErrorMessageResourceName="ValidationErrorRequiredField", ErrorMessageResourceType=typeof(ValidationErrorResources))]
        public string Answer
        {
            get
            {
                return this._answer;
            }
            set
            {
                if ((this._answer != value))
                {
                    this.OnAnswerChanging(value);
                    this.RaiseDataMemberChanging("Answer");
                    this.ValidateProperty("Answer", value);
                    this._answer = value;
                    this.RaiseDataMemberChanged("Answer");
                    this.OnAnswerChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'Email' value.
        /// </summary>
        [DataMember()]
        [Display(Name="EmailLabel", Order=2, ResourceType=typeof(RegistrationDataResources))]
        [Editable(false, AllowInitialValue=true)]
        [Key()]
        [RegularExpression("^([\\w-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([\\w-]+\\.)+))([a-zA-Z]{2,4" +
            "}|[0-9]{1,3})(\\]?)$", ErrorMessageResourceName="ValidationErrorInvalidEmail", ErrorMessageResourceType=typeof(ValidationErrorResources))]
        [Required(ErrorMessageResourceName="ValidationErrorRequiredField", ErrorMessageResourceType=typeof(ValidationErrorResources))]
        [RoundtripOriginal()]
        public string Email
        {
            get
            {
                return this._email;
            }
            set
            {
                if ((this._email != value))
                {
                    this.OnEmailChanging(value);
                    this.ValidateProperty("Email", value);
                    this._email = value;
                    this.RaisePropertyChanged("Email");
                    this.OnEmailChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'FriendlyName' value.
        /// </summary>
        [DataMember()]
        [Display(Description="FriendlyNameDescription", Name="FriendlyNameLabel", Order=1, ResourceType=typeof(RegistrationDataResources))]
        [StringLength(255, ErrorMessageResourceName="ValidationErrorBadFriendlyNameLength", ErrorMessageResourceType=typeof(ValidationErrorResources))]
        public string FriendlyName
        {
            get
            {
                return this._friendlyName;
            }
            set
            {
                if ((this._friendlyName != value))
                {
                    this.OnFriendlyNameChanging(value);
                    this.RaiseDataMemberChanging("FriendlyName");
                    this.ValidateProperty("FriendlyName", value);
                    this._friendlyName = value;
                    this.RaiseDataMemberChanged("FriendlyName");
                    this.OnFriendlyNameChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'Question' value.
        /// </summary>
        [DataMember()]
        [Display(Name="SecurityQuestionLabel", Order=5, ResourceType=typeof(RegistrationDataResources))]
        [Required(ErrorMessageResourceName="ValidationErrorRequiredField", ErrorMessageResourceType=typeof(ValidationErrorResources))]
        public string Question
        {
            get
            {
                return this._question;
            }
            set
            {
                if ((this._question != value))
                {
                    this.OnQuestionChanging(value);
                    this.RaiseDataMemberChanging("Question");
                    this.ValidateProperty("Question", value);
                    this._question = value;
                    this.RaiseDataMemberChanged("Question");
                    this.OnQuestionChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'UserName' value.
        /// </summary>
        [DataMember()]
        [Display(Name="UserNameLabel", Order=0, ResourceType=typeof(RegistrationDataResources))]
        [Editable(false, AllowInitialValue=true)]
        [Key()]
        [RegularExpression("^[a-zA-Z0-9_]*$", ErrorMessageResourceName="ValidationErrorInvalidUserName", ErrorMessageResourceType=typeof(ValidationErrorResources))]
        [Required(ErrorMessageResourceName="ValidationErrorRequiredField", ErrorMessageResourceType=typeof(ValidationErrorResources))]
        [RoundtripOriginal()]
        [StringLength(255, ErrorMessageResourceName="ValidationErrorBadUserNameLength", ErrorMessageResourceType=typeof(ValidationErrorResources), MinimumLength=4)]
        public string UserName
        {
            get
            {
                return this._userName;
            }
            set
            {
                if ((this._userName != value))
                {
                    this.OnUserNameChanging(value);
                    this.ValidateProperty("UserName", value);
                    this._userName = value;
                    this.RaisePropertyChanged("UserName");
                    this.OnUserNameChanged();
                }
            }
        }
        
        /// <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()
        {
            if (((this._email == null) 
                        || (this._userName == null)))
            {
                return null;
            }
            return EntityKey.Create(this._email, this._userName);
        }
    }
    
    /// <summary>
    /// The 'SalesOrderDetail' entity class.
    /// </summary>
    [DataContract(Namespace="http://schemas.datacontract.org/2004/07/ReportingServicesDemo.Web")]
    public sealed partial class SalesOrderDetail : Entity
    {
        
        private decimal _lineTotal;
        
        private DateTime _modifiedDate;
        
        private short _orderQty;
        
        private EntityRef<Product> _product;
        
        private int _productID;
        
        private Guid _rowguid;
        
        private int _salesOrderDetailID;
        
        private EntityRef<SalesOrderHeader> _salesOrderHeader;
        
        private int _salesOrderID;
        
        private decimal _unitPrice;
        
        private decimal _unitPriceDiscount;
        
        #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 OnLineTotalChanging(decimal value);
        partial void OnLineTotalChanged();
        partial void OnModifiedDateChanging(DateTime value);
        partial void OnModifiedDateChanged();
        partial void OnOrderQtyChanging(short value);
        partial void OnOrderQtyChanged();
        partial void OnProductIDChanging(int value);
        partial void OnProductIDChanged();
        partial void OnrowguidChanging(Guid value);
        partial void OnrowguidChanged();
        partial void OnSalesOrderDetailIDChanging(int value);
        partial void OnSalesOrderDetailIDChanged();
        partial void OnSalesOrderIDChanging(int value);
        partial void OnSalesOrderIDChanged();
        partial void OnUnitPriceChanging(decimal value);
        partial void OnUnitPriceChanged();
        partial void OnUnitPriceDiscountChanging(decimal value);
        partial void OnUnitPriceDiscountChanged();

        #endregion
        
        
        /// <summary>
        /// Initializes a new instance of the <see cref="SalesOrderDetail"/> class.
        /// </summary>
        public SalesOrderDetail()
        {
            this.OnCreated();
        }
        
        /// <summary>
        /// Gets or sets the 'LineTotal' value.
        /// </summary>
        [DataMember()]
        public decimal LineTotal
        {
            get
            {
                return this._lineTotal;
            }
            set
            {
                if ((this._lineTotal != value))
                {
                    this.OnLineTotalChanging(value);
                    this.RaiseDataMemberChanging("LineTotal");
                    this.ValidateProperty("LineTotal", value);
                    this._lineTotal = value;
                    this.RaiseDataMemberChanged("LineTotal");
                    this.OnLineTotalChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'ModifiedDate' value.
        /// </summary>
        [DataMember()]
        public DateTime ModifiedDate
        {
            get
            {
                return this._modifiedDate;
            }
            set
            {
                if ((this._modifiedDate != value))
                {
                    this.OnModifiedDateChanging(value);
                    this.RaiseDataMemberChanging("ModifiedDate");
                    this.ValidateProperty("ModifiedDate", value);
                    this._modifiedDate = value;
                    this.RaiseDataMemberChanged("ModifiedDate");
                    this.OnModifiedDateChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'OrderQty' value.
        /// </summary>
        [DataMember()]
        public short OrderQty
        {
            get
            {
                return this._orderQty;
            }
            set
            {
                if ((this._orderQty != value))
                {
                    this.OnOrderQtyChanging(value);
                    this.RaiseDataMemberChanging("OrderQty");
                    this.ValidateProperty("OrderQty", value);
                    this._orderQty = value;
                    this.RaiseDataMemberChanged("OrderQty");
                    this.OnOrderQtyChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the associated <see cref="Product"/> entity.
        /// </summary>
        [Association("Product_SalesOrderDetail", "ProductID", "ProductID", IsForeignKey=true)]
        [XmlIgnore()]
        public Product Product
        {
            get
            {
                if ((this._product == null))
                {
                    this._product = new EntityRef<Product>(this, "Product", this.FilterProduct);
                }
                return this._product.Entity;
            }
            set
            {
                Product previous = this.Product;
                if ((previous != value))
                {
                    this.ValidateProperty("Product", value);
                    if ((previous != null))
                    {
                        this._product.Entity = null;
                        previous.SalesOrderDetail.Remove(this);
                    }
                    if ((value != null))
                    {
                        this.ProductID = value.ProductID;
                    }
                    else
                    {
                        this.ProductID = default(int);
                    }
                    this._product.Entity = value;
                    if ((value != null))
                    {
                        value.SalesOrderDetail.Add(this);
                    }
                    this.RaisePropertyChanged("Product");
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'ProductID' value.
        /// </summary>
        [DataMember()]
        [RoundtripOriginal()]
        public int ProductID
        {
            get
            {
                return this._productID;
            }
            set
            {
                if ((this._productID != value))
                {
                    this.OnProductIDChanging(value);
                    this.RaiseDataMemberChanging("ProductID");
                    this.ValidateProperty("ProductID", value);
                    this._productID = value;
                    this.RaiseDataMemberChanged("ProductID");
                    this.OnProductIDChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'rowguid' value.
        /// </summary>
        [DataMember()]
        public Guid rowguid
        {
            get
            {
                return this._rowguid;
            }
            set
            {
                if ((this._rowguid != value))
                {
                    this.OnrowguidChanging(value);
                    this.RaiseDataMemberChanging("rowguid");
                    this.ValidateProperty("rowguid", value);
                    this._rowguid = value;
                    this.RaiseDataMemberChanged("rowguid");
                    this.OnrowguidChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'SalesOrderDetailID' value.
        /// </summary>
        [DataMember()]
        [Key()]
        [RoundtripOriginal()]
        public int SalesOrderDetailID
        {
            get
            {
                return this._salesOrderDetailID;
            }
            set
            {
                if ((this._salesOrderDetailID != value))
                {
                    this.OnSalesOrderDetailIDChanging(value);
                    this.RaiseDataMemberChanging("SalesOrderDetailID");
                    this.ValidateProperty("SalesOrderDetailID", value);
                    this._salesOrderDetailID = value;
                    this.RaiseDataMemberChanged("SalesOrderDetailID");
                    this.OnSalesOrderDetailIDChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the associated <see cref="SalesOrderHeader"/> entity.
        /// </summary>
        [Association("SalesOrderHeader_SalesOrderDetail", "SalesOrderID", "SalesOrderID", IsForeignKey=true)]
        [XmlIgnore()]
        public SalesOrderHeader SalesOrderHeader
        {
            get
            {
                if ((this._salesOrderHeader == null))
                {
                    this._salesOrderHeader = new EntityRef<SalesOrderHeader>(this, "SalesOrderHeader", this.FilterSalesOrderHeader);
                }
                return this._salesOrderHeader.Entity;
            }
            set
            {
                SalesOrderHeader previous = this.SalesOrderHeader;
                if ((previous != value))
                {
                    this.ValidateProperty("SalesOrderHeader", value);
                    if ((previous != null))
                    {
                        this._salesOrderHeader.Entity = null;
                        previous.SalesOrderDetail.Remove(this);
                    }
                    if ((value != null))
                    {
                        this.SalesOrderID = value.SalesOrderID;
                    }
                    else
                    {
                        this.SalesOrderID = default(int);
                    }
                    this._salesOrderHeader.Entity = value;
                    if ((value != null))
                    {
                        value.SalesOrderDetail.Add(this);
                    }
                    this.RaisePropertyChanged("SalesOrderHeader");
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'SalesOrderID' value.
        /// </summary>
        [DataMember()]
        [Key()]
        [RoundtripOriginal()]
        public int SalesOrderID
        {
            get
            {
                return this._salesOrderID;
            }
            set
            {
                if ((this._salesOrderID != value))
                {
                    this.OnSalesOrderIDChanging(value);
                    this.RaiseDataMemberChanging("SalesOrderID");
                    this.ValidateProperty("SalesOrderID", value);
                    this._salesOrderID = value;
                    this.RaiseDataMemberChanged("SalesOrderID");
                    this.OnSalesOrderIDChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'UnitPrice' value.
        /// </summary>
        [DataMember()]
        public decimal UnitPrice
        {
            get
            {
                return this._unitPrice;
            }
            set
            {
                if ((this._unitPrice != value))
                {
                    this.OnUnitPriceChanging(value);
                    this.RaiseDataMemberChanging("UnitPrice");
                    this.ValidateProperty("UnitPrice", value);
                    this._unitPrice = value;
                    this.RaiseDataMemberChanged("UnitPrice");
                    this.OnUnitPriceChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'UnitPriceDiscount' value.
        /// </summary>
        [DataMember()]
        public decimal UnitPriceDiscount
        {
            get
            {
                return this._unitPriceDiscount;
            }
            set
            {
                if ((this._unitPriceDiscount != value))
                {
                    this.OnUnitPriceDiscountChanging(value);
                    this.RaiseDataMemberChanging("UnitPriceDiscount");
                    this.ValidateProperty("UnitPriceDiscount", value);
                    this._unitPriceDiscount = value;
                    this.RaiseDataMemberChanged("UnitPriceDiscount");
                    this.OnUnitPriceDiscountChanged();
                }
            }
        }
        
        private bool FilterProduct(Product entity)
        {
            return (entity.ProductID == this.ProductID);
        }
        
        private bool FilterSalesOrderHeader(SalesOrderHeader entity)
        {
            return (entity.SalesOrderID == this.SalesOrderID);
        }
        
        /// <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._salesOrderDetailID, this._salesOrderID);
        }
    }
    
    /// <summary>
    /// The 'SalesOrderHeader' entity class.
    /// </summary>
    [DataContract(Namespace="http://schemas.datacontract.org/2004/07/ReportingServicesDemo.Web")]
    public sealed partial class SalesOrderHeader : Entity
    {
        
        private string _accountNumber;
        
        private EntityRef<Address> _address;
        
        private EntityRef<Address> _address1;
        
        private Nullable<int> _billToAddressID;
        
        private string _comment;
        
        private string _creditCardApprovalCode;
        
        private EntityRef<Customer> _customer;
        
        private int _customerID;
        
        private DateTime _dueDate;
        
        private decimal _freight;
        
        private DateTime _modifiedDate;
        
        private bool _onlineOrderFlag;
        
        private DateTime _orderDate;
        
        private string _purchaseOrderNumber;
        
        private byte _revisionNumber;
        
        private Guid _rowguid;
        
        private EntityCollection<SalesOrderDetail> _salesOrderDetail;
        
        private int _salesOrderID;
        
        private string _salesOrderNumber;
        
        private Nullable<DateTime> _shipDate;
        
        private string _shipMethod;
        
        private Nullable<int> _shipToAddressID;
        
        private byte _status;
        
        private decimal _subTotal;
        
        private decimal _taxAmt;
        
        private decimal _totalDue;
        
        #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 OnAccountNumberChanging(string value);
        partial void OnAccountNumberChanged();
        partial void OnBillToAddressIDChanging(Nullable<int> value);
        partial void OnBillToAddressIDChanged();
        partial void OnCommentChanging(string value);
        partial void OnCommentChanged();
        partial void OnCreditCardApprovalCodeChanging(string value);
        partial void OnCreditCardApprovalCodeChanged();
        partial void OnCustomerIDChanging(int value);
        partial void OnCustomerIDChanged();
        partial void OnDueDateChanging(DateTime value);
        partial void OnDueDateChanged();
        partial void OnFreightChanging(decimal value);
        partial void OnFreightChanged();
        partial void OnModifiedDateChanging(DateTime value);
        partial void OnModifiedDateChanged();
        partial void OnOnlineOrderFlagChanging(bool value);
        partial void OnOnlineOrderFlagChanged();
        partial void OnOrderDateChanging(DateTime value);
        partial void OnOrderDateChanged();
        partial void OnPurchaseOrderNumberChanging(string value);
        partial void OnPurchaseOrderNumberChanged();
        partial void OnRevisionNumberChanging(byte value);
        partial void OnRevisionNumberChanged();
        partial void OnrowguidChanging(Guid value);
        partial void OnrowguidChanged();
        partial void OnSalesOrderIDChanging(int value);
        partial void OnSalesOrderIDChanged();
        partial void OnSalesOrderNumberChanging(string value);
        partial void OnSalesOrderNumberChanged();
        partial void OnShipDateChanging(Nullable<DateTime> value);
        partial void OnShipDateChanged();
        partial void OnShipMethodChanging(string value);
        partial void OnShipMethodChanged();
        partial void OnShipToAddressIDChanging(Nullable<int> value);
        partial void OnShipToAddressIDChanged();
        partial void OnStatusChanging(byte value);
        partial void OnStatusChanged();
        partial void OnSubTotalChanging(decimal value);
        partial void OnSubTotalChanged();
        partial void OnTaxAmtChanging(decimal value);
        partial void OnTaxAmtChanged();
        partial void OnTotalDueChanging(decimal value);
        partial void OnTotalDueChanged();

        #endregion
        
        
        /// <summary>
        /// Initializes a new instance of the <see cref="SalesOrderHeader"/> class.
        /// </summary>
        public SalesOrderHeader()
        {
            this.OnCreated();
        }
        
        /// <summary>
        /// Gets or sets the 'AccountNumber' value.
        /// </summary>
        [DataMember()]
        [StringLength(15)]
        public string AccountNumber
        {
            get
            {
                return this._accountNumber;
            }
            set
            {
                if ((this._accountNumber != value))
                {
                    this.OnAccountNumberChanging(value);
                    this.RaiseDataMemberChanging("AccountNumber");
                    this.ValidateProperty("AccountNumber", value);
                    this._accountNumber = value;
                    this.RaiseDataMemberChanged("AccountNumber");
                    this.OnAccountNumberChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the associated <see cref="Address"/> entity.
        /// </summary>
        [Association("Address_SalesOrderHeader", "BillToAddressID", "AddressID", IsForeignKey=true)]
        [XmlIgnore()]
        public Address Address
        {
            get
            {
                if ((this._address == null))
                {
                    this._address = new EntityRef<Address>(this, "Address", this.FilterAddress);
                }
                return this._address.Entity;
            }
            set
            {
                Address previous = this.Address;
                if ((previous != value))
                {
                    this.ValidateProperty("Address", value);
                    if ((previous != null))
                    {
                        this._address.Entity = null;
                        previous.SalesOrderHeader.Remove(this);
                    }
                    if ((value != null))
                    {
                        this.BillToAddressID = value.AddressID;
                    }
                    else
                    {
                        this.BillToAddressID = default(Nullable<int>);
                    }
                    this._address.Entity = value;
                    if ((value != null))
                    {
                        value.SalesOrderHeader.Add(this);
                    }
                    this.RaisePropertyChanged("Address");
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the associated <see cref="Address"/> entity.
        /// </summary>
        [Association("Address_SalesOrderHeader1", "ShipToAddressID", "AddressID", IsForeignKey=true)]
        [XmlIgnore()]
        public Address Address1
        {
            get
            {
                if ((this._address1 == null))
                {
                    this._address1 = new EntityRef<Address>(this, "Address1", this.FilterAddress1);
                }
                return this._address1.Entity;
            }
            set
            {
                Address previous = this.Address1;
                if ((previous != value))
                {
                    this.ValidateProperty("Address1", value);
                    if ((previous != null))
                    {
                        this._address1.Entity = null;
                        previous.SalesOrderHeader1.Remove(this);
                    }
                    if ((value != null))
                    {
                        this.ShipToAddressID = value.AddressID;
                    }
                    else
                    {
                        this.ShipToAddressID = default(Nullable<int>);
                    }
                    this._address1.Entity = value;
                    if ((value != null))
                    {
                        value.SalesOrderHeader1.Add(this);
                    }
                    this.RaisePropertyChanged("Address1");
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'BillToAddressID' value.
        /// </summary>
        [DataMember()]
        [RoundtripOriginal()]
        public Nullable<int> BillToAddressID
        {
            get
            {
                return this._billToAddressID;
            }
            set
            {
                if ((this._billToAddressID != value))
                {
                    this.OnBillToAddressIDChanging(value);
                    this.RaiseDataMemberChanging("BillToAddressID");
                    this.ValidateProperty("BillToAddressID", value);
                    this._billToAddressID = value;
                    this.RaiseDataMemberChanged("BillToAddressID");
                    this.OnBillToAddressIDChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'Comment' value.
        /// </summary>
        [DataMember()]
        public string Comment
        {
            get
            {
                return this._comment;
            }
            set
            {
                if ((this._comment != value))
                {
                    this.OnCommentChanging(value);
                    this.RaiseDataMemberChanging("Comment");
                    this.ValidateProperty("Comment", value);
                    this._comment = value;
                    this.RaiseDataMemberChanged("Comment");
                    this.OnCommentChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'CreditCardApprovalCode' value.
        /// </summary>
        [DataMember()]
        [StringLength(15)]
        public string CreditCardApprovalCode
        {
            get
            {
                return this._creditCardApprovalCode;
            }
            set
            {
                if ((this._creditCardApprovalCode != value))
                {
                    this.OnCreditCardApprovalCodeChanging(value);
                    this.RaiseDataMemberChanging("CreditCardApprovalCode");
                    this.ValidateProperty("CreditCardApprovalCode", value);
                    this._creditCardApprovalCode = value;
                    this.RaiseDataMemberChanged("CreditCardApprovalCode");
                    this.OnCreditCardApprovalCodeChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the associated <see cref="Customer"/> entity.
        /// </summary>
        [Association("Customer_SalesOrderHeader", "CustomerID", "CustomerID", IsForeignKey=true)]
        [XmlIgnore()]
        public Customer Customer
        {
            get
            {
                if ((this._customer == null))
                {
                    this._customer = new EntityRef<Customer>(this, "Customer", this.FilterCustomer);
                }
                return this._customer.Entity;
            }
            set
            {
                Customer previous = this.Customer;
                if ((previous != value))
                {
                    this.ValidateProperty("Customer", value);
                    if ((previous != null))
                    {
                        this._customer.Entity = null;
                        previous.SalesOrderHeader.Remove(this);
                    }
                    if ((value != null))
                    {
                        this.CustomerID = value.CustomerID;
                    }
                    else
                    {
                        this.CustomerID = default(int);
                    }
                    this._customer.Entity = value;
                    if ((value != null))
                    {
                        value.SalesOrderHeader.Add(this);
                    }
                    this.RaisePropertyChanged("Customer");
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'CustomerID' value.
        /// </summary>
        [DataMember()]
        [RoundtripOriginal()]
        public int CustomerID
        {
            get
            {
                return this._customerID;
            }
            set
            {
                if ((this._customerID != value))
                {
                    this.OnCustomerIDChanging(value);
                    this.RaiseDataMemberChanging("CustomerID");
                    this.ValidateProperty("CustomerID", value);
                    this._customerID = value;
                    this.RaiseDataMemberChanged("CustomerID");
                    this.OnCustomerIDChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'DueDate' value.
        /// </summary>
        [DataMember()]
        public DateTime DueDate
        {
            get
            {
                return this._dueDate;
            }
            set
            {
                if ((this._dueDate != value))
                {
                    this.OnDueDateChanging(value);
                    this.RaiseDataMemberChanging("DueDate");
                    this.ValidateProperty("DueDate", value);
                    this._dueDate = value;
                    this.RaiseDataMemberChanged("DueDate");
                    this.OnDueDateChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'Freight' value.
        /// </summary>
        [DataMember()]
        public decimal Freight
        {
            get
            {
                return this._freight;
            }
            set
            {
                if ((this._freight != value))
                {
                    this.OnFreightChanging(value);
                    this.RaiseDataMemberChanging("Freight");
                    this.ValidateProperty("Freight", value);
                    this._freight = value;
                    this.RaiseDataMemberChanged("Freight");
                    this.OnFreightChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'ModifiedDate' value.
        /// </summary>
        [DataMember()]
        public DateTime ModifiedDate
        {
            get
            {
                return this._modifiedDate;
            }
            set
            {
                if ((this._modifiedDate != value))
                {
                    this.OnModifiedDateChanging(value);
                    this.RaiseDataMemberChanging("ModifiedDate");
                    this.ValidateProperty("ModifiedDate", value);
                    this._modifiedDate = value;
                    this.RaiseDataMemberChanged("ModifiedDate");
                    this.OnModifiedDateChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'OnlineOrderFlag' value.
        /// </summary>
        [DataMember()]
        public bool OnlineOrderFlag
        {
            get
            {
                return this._onlineOrderFlag;
            }
            set
            {
                if ((this._onlineOrderFlag != value))
                {
                    this.OnOnlineOrderFlagChanging(value);
                    this.RaiseDataMemberChanging("OnlineOrderFlag");
                    this.ValidateProperty("OnlineOrderFlag", value);
                    this._onlineOrderFlag = value;
                    this.RaiseDataMemberChanged("OnlineOrderFlag");
                    this.OnOnlineOrderFlagChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'OrderDate' value.
        /// </summary>
        [DataMember()]
        public DateTime OrderDate
        {
            get
            {
                return this._orderDate;
            }
            set
            {
                if ((this._orderDate != value))
                {
                    this.OnOrderDateChanging(value);
                    this.RaiseDataMemberChanging("OrderDate");
                    this.ValidateProperty("OrderDate", value);
                    this._orderDate = value;
                    this.RaiseDataMemberChanged("OrderDate");
                    this.OnOrderDateChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'PurchaseOrderNumber' value.
        /// </summary>
        [DataMember()]
        [StringLength(25)]
        public string PurchaseOrderNumber
        {
            get
            {
                return this._purchaseOrderNumber;
            }
            set
            {
                if ((this._purchaseOrderNumber != value))
                {
                    this.OnPurchaseOrderNumberChanging(value);
                    this.RaiseDataMemberChanging("PurchaseOrderNumber");
                    this.ValidateProperty("PurchaseOrderNumber", value);
                    this._purchaseOrderNumber = value;
                    this.RaiseDataMemberChanged("PurchaseOrderNumber");
                    this.OnPurchaseOrderNumberChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'RevisionNumber' value.
        /// </summary>
        [DataMember()]
        public byte RevisionNumber
        {
            get
            {
                return this._revisionNumber;
            }
            set
            {
                if ((this._revisionNumber != value))
                {
                    this.OnRevisionNumberChanging(value);
                    this.RaiseDataMemberChanging("RevisionNumber");
                    this.ValidateProperty("RevisionNumber", value);
                    this._revisionNumber = value;
                    this.RaiseDataMemberChanged("RevisionNumber");
                    this.OnRevisionNumberChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'rowguid' value.
        /// </summary>
        [DataMember()]
        public Guid rowguid
        {
            get
            {
                return this._rowguid;
            }
            set
            {
                if ((this._rowguid != value))
                {
                    this.OnrowguidChanging(value);
                    this.RaiseDataMemberChanging("rowguid");
                    this.ValidateProperty("rowguid", value);
                    this._rowguid = value;
                    this.RaiseDataMemberChanged("rowguid");
                    this.OnrowguidChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets the collection of associated <see cref="SalesOrderDetail"/> entities.
        /// </summary>
        [Association("SalesOrderHeader_SalesOrderDetail", "SalesOrderID", "SalesOrderID")]
        [XmlIgnore()]
        public EntityCollection<SalesOrderDetail> SalesOrderDetail
        {
            get
            {
                if ((this._salesOrderDetail == null))
                {
                    this._salesOrderDetail = new EntityCollection<SalesOrderDetail>(this, "SalesOrderDetail", this.FilterSalesOrderDetail, this.AttachSalesOrderDetail, this.DetachSalesOrderDetail);
                }
                return this._salesOrderDetail;
            }
        }
        
        /// <summary>
        /// Gets or sets the 'SalesOrderID' value.
        /// </summary>
        [DataMember()]
        [Editable(false, AllowInitialValue=true)]
        [Key()]
        [RoundtripOriginal()]
        public int SalesOrderID
        {
            get
            {
                return this._salesOrderID;
            }
            set
            {
                if ((this._salesOrderID != value))
                {
                    this.OnSalesOrderIDChanging(value);
                    this.ValidateProperty("SalesOrderID", value);
                    this._salesOrderID = value;
                    this.RaisePropertyChanged("SalesOrderID");
                    this.OnSalesOrderIDChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'SalesOrderNumber' value.
        /// </summary>
        [DataMember()]
        [Required()]
        [StringLength(25)]
        public string SalesOrderNumber
        {
            get
            {
                return this._salesOrderNumber;
            }
            set
            {
                if ((this._salesOrderNumber != value))
                {
                    this.OnSalesOrderNumberChanging(value);
                    this.RaiseDataMemberChanging("SalesOrderNumber");
                    this.ValidateProperty("SalesOrderNumber", value);
                    this._salesOrderNumber = value;
                    this.RaiseDataMemberChanged("SalesOrderNumber");
                    this.OnSalesOrderNumberChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'ShipDate' value.
        /// </summary>
        [DataMember()]
        public Nullable<DateTime> ShipDate
        {
            get
            {
                return this._shipDate;
            }
            set
            {
                if ((this._shipDate != value))
                {
                    this.OnShipDateChanging(value);
                    this.RaiseDataMemberChanging("ShipDate");
                    this.ValidateProperty("ShipDate", value);
                    this._shipDate = value;
                    this.RaiseDataMemberChanged("ShipDate");
                    this.OnShipDateChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'ShipMethod' value.
        /// </summary>
        [DataMember()]
        [Required()]
        [StringLength(50)]
        public string ShipMethod
        {
            get
            {
                return this._shipMethod;
            }
            set
            {
                if ((this._shipMethod != value))
                {
                    this.OnShipMethodChanging(value);
                    this.RaiseDataMemberChanging("ShipMethod");
                    this.ValidateProperty("ShipMethod", value);
                    this._shipMethod = value;
                    this.RaiseDataMemberChanged("ShipMethod");
                    this.OnShipMethodChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'ShipToAddressID' value.
        /// </summary>
        [DataMember()]
        [RoundtripOriginal()]
        public Nullable<int> ShipToAddressID
        {
            get
            {
                return this._shipToAddressID;
            }
            set
            {
                if ((this._shipToAddressID != value))
                {
                    this.OnShipToAddressIDChanging(value);
                    this.RaiseDataMemberChanging("ShipToAddressID");
                    this.ValidateProperty("ShipToAddressID", value);
                    this._shipToAddressID = value;
                    this.RaiseDataMemberChanged("ShipToAddressID");
                    this.OnShipToAddressIDChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'Status' value.
        /// </summary>
        [DataMember()]
        public byte Status
        {
            get
            {
                return this._status;
            }
            set
            {
                if ((this._status != value))
                {
                    this.OnStatusChanging(value);
                    this.RaiseDataMemberChanging("Status");
                    this.ValidateProperty("Status", value);
                    this._status = value;
                    this.RaiseDataMemberChanged("Status");
                    this.OnStatusChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'SubTotal' value.
        /// </summary>
        [DataMember()]
        public decimal SubTotal
        {
            get
            {
                return this._subTotal;
            }
            set
            {
                if ((this._subTotal != value))
                {
                    this.OnSubTotalChanging(value);
                    this.RaiseDataMemberChanging("SubTotal");
                    this.ValidateProperty("SubTotal", value);
                    this._subTotal = value;
                    this.RaiseDataMemberChanged("SubTotal");
                    this.OnSubTotalChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'TaxAmt' value.
        /// </summary>
        [DataMember()]
        public decimal TaxAmt
        {
            get
            {
                return this._taxAmt;
            }
            set
            {
                if ((this._taxAmt != value))
                {
                    this.OnTaxAmtChanging(value);
                    this.RaiseDataMemberChanging("TaxAmt");
                    this.ValidateProperty("TaxAmt", value);
                    this._taxAmt = value;
                    this.RaiseDataMemberChanged("TaxAmt");
                    this.OnTaxAmtChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'TotalDue' value.
        /// </summary>
        [DataMember()]
        public decimal TotalDue
        {
            get
            {
                return this._totalDue;
            }
            set
            {
                if ((this._totalDue != value))
                {
                    this.OnTotalDueChanging(value);
                    this.RaiseDataMemberChanging("TotalDue");
                    this.ValidateProperty("TotalDue", value);
                    this._totalDue = value;
                    this.RaiseDataMemberChanged("TotalDue");
                    this.OnTotalDueChanged();
                }
            }
        }
        
        private bool FilterAddress(Address entity)
        {
            return (entity.AddressID == this.BillToAddressID);
        }
        
        private bool FilterAddress1(Address entity)
        {
            return (entity.AddressID == this.ShipToAddressID);
        }
        
        private bool FilterCustomer(Customer entity)
        {
            return (entity.CustomerID == this.CustomerID);
        }
        
        private void AttachSalesOrderDetail(SalesOrderDetail entity)
        {
            entity.SalesOrderHeader = this;
        }
        
        private void DetachSalesOrderDetail(SalesOrderDetail entity)
        {
            entity.SalesOrderHeader = null;
        }
        
        private bool FilterSalesOrderDetail(SalesOrderDetail entity)
        {
            return (entity.SalesOrderID == this.SalesOrderID);
        }
        
        /// <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 this._salesOrderID;
        }
    }
    
    /// <summary>
    /// The 'User' entity class.
    /// </summary>
    [DataContract(Namespace="http://schemas.datacontract.org/2004/07/ReportingServicesDemo.Web")]
    public sealed partial class User : Entity, global::System.Security.Principal.IIdentity, global::System.Security.Principal.IPrincipal
    {
        
        private string _friendlyName;
        
        private string _name = string.Empty;
        
        private IEnumerable<string> _roles;
        
        #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 OnFriendlyNameChanging(string value);
        partial void OnFriendlyNameChanged();
        partial void OnNameChanging(string value);
        partial void OnNameChanged();
        partial void OnRolesChanging(IEnumerable<string> value);
        partial void OnRolesChanged();

        #endregion
        
        
        /// <summary>
        /// Initializes a new instance of the <see cref="User"/> class.
        /// </summary>
        public User()
        {
            this.OnCreated();
        }
        
        /// <summary>
        /// Gets or sets the 'FriendlyName' value.
        /// </summary>
        [DataMember()]
        public string FriendlyName
        {
            get
            {
                return this._friendlyName;
            }
            set
            {
                if ((this._friendlyName != value))
                {
                    this.OnFriendlyNameChanging(value);
                    this.RaiseDataMemberChanging("FriendlyName");
                    this.ValidateProperty("FriendlyName", value);
                    this._friendlyName = value;
                    this.RaiseDataMemberChanged("FriendlyName");
                    this.OnFriendlyNameChanged();
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'Name' value.
        /// </summary>
        [DataMember()]
        [Editable(false, AllowInitialValue=true)]
        [Key()]
        [RoundtripOriginal()]
        public string Name
        {
            get
            {
                return this._name;
            }
            set
            {
                if ((this._name != value))
                {
                    this.OnNameChanging(value);
                    this.ValidateProperty("Name", value);
                    this._name = value;
                    this.RaisePropertyChanged("Name");
                    this.OnNameChanged();
                    this.RaisePropertyChanged("IsAuthenticated");
                }
            }
        }
        
        /// <summary>
        /// Gets or sets the 'Roles' value.
        /// </summary>
        [DataMember()]
        [Editable(false)]
        public IEnumerable<string> Roles
        {
            get
            {
                return this._roles;
            }
            set
            {
                if ((this._roles != value))
                {
                    this.OnRolesChanging(value);
                    this.ValidateProperty("Roles", value);
                    this._roles = value;
                    this.RaisePropertyChanged("Roles");
                    this.OnRolesChanged();
                }
            }
        }
        
        string global::System.Security.Principal.IIdentity.AuthenticationType
        {
            get
            {
                return string.Empty;
            }
        }
        
        /// <summary>
        /// Gets a value indicating whether the identity is authenticated.
        /// </summary>
        /// <remarks>
        /// This value is <c>true</c> if <see cref="Name"/> is not <c>null</c> or empty.
        /// </remarks>
        public bool IsAuthenticated
        {
            get
            {
                return (true != string.IsNullOrEmpty(this.Name));
            }
        }
        
        string global::System.Security.Principal.IIdentity.Name
        {
            get
            {
                return this.Name;
            }
        }
        
        global::System.Security.Principal.IIdentity global::System.Security.Principal.IPrincipal.Identity
        {
            get
            {
                return this;
            }
        }
        
        /// <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 this._name;
        }
        
        /// <summary>
        /// Return whether the principal is in the role.
        /// </summary>
        /// <remarks>
        /// Returns whether the specified role is contained in the roles.
        /// This implementation is case sensitive.
        /// </remarks>
        /// <param name="role">The name of the role for which to check membership.</param>
        /// <returns>Whether the principal is in the role.</returns>
        public bool IsInRole(string role)
        {
            if ((this.Roles == null))
            {
                return false;
            }
            return global::System.Linq.Enumerable.Contains(this.Roles, role);
        }
    }
    
    /// <summary>
    /// The domain context corresponding to the 'UserRegistrationService' domain service.
    /// </summary>
    public sealed partial class UserRegistrationContext : 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="UserRegistrationContext"/> class.
        /// </summary>
        public UserRegistrationContext() : 
                this(new WebDomainClient<IUserRegistrationServiceContract>(new Uri("ReportingServicesDemo-Web-UserRegistrationService.svc", UriKind.Relative)))
        {
        }
        
        /// <summary>
        /// Initializes a new instance of the <see cref="UserRegistrationContext"/> class with the specified service URI.
        /// </summary>
        /// <param name="serviceUri">The UserRegistrationService service URI.</param>
        public UserRegistrationContext(Uri serviceUri) : 
                this(new WebDomainClient<IUserRegistrationServiceContract>(serviceUri))
        {
        }
        
        /// <summary>
        /// Initializes a new instance of the <see cref="UserRegistrationContext"/> class with the specified <paramref name="domainClient"/>.
        /// </summary>
        /// <param name="domainClient">The DomainClient instance to use for this domain context.</param>
        public UserRegistrationContext(DomainClient domainClient) : 
                base(domainClient)
        {
            this.OnCreated();
        }
        
        /// <summary>
        /// Gets the set of <see cref="RegistrationData"/> entities that have been loaded into this <see cref="UserRegistrationContext"/> instance.
        /// </summary>
        public EntitySet<RegistrationData> RegistrationDatas
        {
            get
            {
                return base.EntityContainer.GetEntitySet<RegistrationData>();
            }
        }
        
        /// <summary>
        /// Gets an EntityQuery instance that can be used to load <see cref="RegistrationData"/> entities using the 'GetUsers' query.
        /// </summary>
        /// <returns>An EntityQuery that can be loaded to retrieve <see cref="RegistrationData"/> entities.</returns>
        public EntityQuery<RegistrationData> GetUsersQuery()
        {
            this.ValidateMethod("GetUsersQuery", null);
            return base.CreateQuery<RegistrationData>("GetUsers", null, false, true);
        }
        
        /// <summary>
        /// Asynchronously invokes the 'CreateUser' method of the domain service.
        /// </summary>
        /// <param name="user">The value for the 'user' parameter of this action.</param>
        /// <param name="password">The value for the 'password' parameter of this action.</param>
        /// <param name="callback">Callback to invoke when the operation completes.</param>
        /// <param name="userState">Value to pass to the callback.  It can be <c>null</c>.</param>
        /// <returns>An operation instance that can be used to manage the asynchronous request.</returns>
        public InvokeOperation<CreateUserStatus> CreateUser(RegistrationData user, [RegularExpression("^.*[^a-zA-Z0-9].*$", ErrorMessageResourceName="ValidationErrorBadPasswordStrength", ErrorMessageResourceType=typeof(ValidationErrorResources))] [Required(ErrorMessageResourceName="ValidationErrorRequiredField", ErrorMessageResourceType=typeof(ValidationErrorResources))] [StringLength(50, ErrorMessageResourceName="ValidationErrorBadPasswordLength", ErrorMessageResourceType=typeof(ValidationErrorResources), MinimumLength=7)] string password, Action<InvokeOperation<CreateUserStatus>> callback, object userState)
        {
            Dictionary<string, object> parameters = new Dictionary<string, object>();
            parameters.Add("user", user);
            parameters.Add("password", password);
            this.ValidateMethod("CreateUser", parameters);
            return ((InvokeOperation<CreateUserStatus>)(this.InvokeOperation("CreateUser", typeof(CreateUserStatus), parameters, true, callback, userState)));
        }
        
        /// <summary>
        /// Asynchronously invokes the 'CreateUser' method of the domain service.
        /// </summary>
        /// <param name="user">The value for the 'user' parameter of this action.</param>
        /// <param name="password">The value for the 'password' parameter of this action.</param>
        /// <returns>An operation instance that can be used to manage the asynchronous request.</returns>
        public InvokeOperation<CreateUserStatus> CreateUser(RegistrationData user, [RegularExpression("^.*[^a-zA-Z0-9].*$", ErrorMessageResourceName="ValidationErrorBadPasswordStrength", ErrorMessageResourceType=typeof(ValidationErrorResources))] [Required(ErrorMessageResourceName="ValidationErrorRequiredField", ErrorMessageResourceType=typeof(ValidationErrorResources))] [StringLength(50, ErrorMessageResourceName="ValidationErrorBadPasswordLength", ErrorMessageResourceType=typeof(ValidationErrorResources), MinimumLength=7)] string password)
        {
            Dictionary<string, object> parameters = new Dictionary<string, object>();
            parameters.Add("user", user);
            parameters.Add("password", password);
            this.ValidateMethod("CreateUser", parameters);
            return ((InvokeOperation<CreateUserStatus>)(this.InvokeOperation("CreateUser", typeof(CreateUserStatus), parameters, true, null, null)));
        }
        
        /// <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 UserRegistrationContextEntityContainer();
        }
        
        /// <summary>
        /// Service contract for the 'UserRegistrationService' domain service.
        /// </summary>
        [ServiceContract()]
        public interface IUserRegistrationServiceContract
        {
            
            /// <summary>
            /// Asynchronously invokes the 'CreateUser' operation.
            /// </summary>
            /// <param name="user">The value for the 'user' parameter of this action.</param>
            /// <param name="password">The value for the 'password' parameter of this action.</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/UserRegistrationService/CreateUserDomainServiceFault", Name="DomainServiceFault", Namespace="DomainServices")]
            [OperationContract(AsyncPattern=true, Action="http://tempuri.org/UserRegistrationService/CreateUser", ReplyAction="http://tempuri.org/UserRegistrationService/CreateUserResponse")]
            IAsyncResult BeginCreateUser(RegistrationData user, string password, AsyncCallback callback, object asyncState);
            
            /// <summary>
            /// Completes the asynchronous operation begun by 'BeginCreateUser'.
            /// </summary>
            /// <param name="result">The IAsyncResult returned from 'BeginCreateUser'.</param>
            /// <returns>The 'CreateUserStatus' returned from the 'CreateUser' operation.</returns>
            CreateUserStatus EndCreateUser(IAsyncResult result);
            
            /// <summary>
            /// Asynchronously invokes the 'GetUsers' 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/UserRegistrationService/GetUsersDomainServiceFault", Name="DomainServiceFault", Namespace="DomainServices")]
            [OperationContract(AsyncPattern=true, Action="http://tempuri.org/UserRegistrationService/GetUsers", ReplyAction="http://tempuri.org/UserRegistrationService/GetUsersResponse")]
            [WebGet()]
            IAsyncResult BeginGetUsers(AsyncCallback callback, object asyncState);
            
            /// <summary>
            /// Completes the asynchronous operation begun by 'BeginGetUsers'.
            /// </summary>
            /// <param name="result">The IAsyncResult returned from 'BeginGetUsers'.</param>
            /// <returns>The 'QueryResult' returned from the 'GetUsers' operation.</returns>
            QueryResult<RegistrationData> EndGetUsers(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/UserRegistrationService/SubmitChangesDomainServiceFault", Name="DomainServiceFault", Namespace="DomainServices")]
            [OperationContract(AsyncPattern=true, Action="http://tempuri.org/UserRegistrationService/SubmitChanges", ReplyAction="http://tempuri.org/UserRegistrationService/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 UserRegistrationContextEntityContainer : EntityContainer
        {
            
            public UserRegistrationContextEntityContainer()
            {
                this.CreateEntitySet<RegistrationData>(EntitySetOperations.None);
            }
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Ernesto Herrera
Web Developer Sigo S.A.
Venezuela Venezuela
Ernesto Herrera is a Senior Developer, Architect with more than 12 years experience, actually working with Silverlight Line-of-Bussiness Applications, he holds a MCTS Web Application 2.0 Certification, and have a wide experience with sql server since the 6.5 version, on his free time he likes to play tennis with his wife,kids and friends, also enjoy playing Wii with his sons, he works at Sigo S.A., a retail business located at Margarita Island, Venezuela.
Follow on   Twitter

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.141223.1 | Last Updated 28 Jul 2010
Article Copyright 2010 by Ernesto Herrera
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid