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

Option Compare Binary
Option Infer On
Option Strict On
Option Explicit On

Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.ComponentModel.DataAnnotations
Imports System.Linq
Imports System.Runtime.Serialization
Imports System.ServiceModel
Imports System.ServiceModel.DomainServices
Imports System.ServiceModel.DomainServices.Client
Imports System.ServiceModel.DomainServices.Client.ApplicationServices
Imports System.ServiceModel.Web
Imports System.Xml.Serialization


''' <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>
Partial Public NotInheritable Class WebContext
    Inherits 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>
    Private Partial Sub OnCreated()
    End Sub

    #End Region
    
    
    ''' <summary>
    ''' Initializes a new instance of the WebContext class.
    ''' </summary>
    Public Sub New()
        MyBase.New
        Me.OnCreated
    End Sub
    
    ''' <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 Shadows Shared ReadOnly Property Current() As WebContext
        Get
            Return CType(WebContextBase.Current,WebContext)
        End Get
    End Property
End Class

Namespace Web
    
    ''' <summary>
    ''' The 'Customer' entity class.
    ''' </summary>
    <DataContract([Namespace]:="http://schemas.datacontract.org/2004/07/TransactionsSilverlight.Web")>  _
    Partial Public NotInheritable Class Customer
        Inherits Entity
        
        Private _address As String
        
        Private _city As String
        
        Private _companyName As String
        
        Private _contactName As String
        
        Private _contactTitle As String
        
        Private _country As String
        
        Private _customerID As String
        
        Private _fax As String
        
        Private _orders As EntityCollection(Of Order)
        
        Private _phone As String
        
        Private _postalCode As String
        
        Private _region As String
        
        #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>
        Private Partial Sub OnCreated()
        End Sub
        Private Partial Sub OnAddressChanging(ByVal value As String)
        End Sub
        Private Partial Sub OnAddressChanged()
        End Sub
        Private Partial Sub OnCityChanging(ByVal value As String)
        End Sub
        Private Partial Sub OnCityChanged()
        End Sub
        Private Partial Sub OnCompanyNameChanging(ByVal value As String)
        End Sub
        Private Partial Sub OnCompanyNameChanged()
        End Sub
        Private Partial Sub OnContactNameChanging(ByVal value As String)
        End Sub
        Private Partial Sub OnContactNameChanged()
        End Sub
        Private Partial Sub OnContactTitleChanging(ByVal value As String)
        End Sub
        Private Partial Sub OnContactTitleChanged()
        End Sub
        Private Partial Sub OnCountryChanging(ByVal value As String)
        End Sub
        Private Partial Sub OnCountryChanged()
        End Sub
        Private Partial Sub OnCustomerIDChanging(ByVal value As String)
        End Sub
        Private Partial Sub OnCustomerIDChanged()
        End Sub
        Private Partial Sub OnFaxChanging(ByVal value As String)
        End Sub
        Private Partial Sub OnFaxChanged()
        End Sub
        Private Partial Sub OnPhoneChanging(ByVal value As String)
        End Sub
        Private Partial Sub OnPhoneChanged()
        End Sub
        Private Partial Sub OnPostalCodeChanging(ByVal value As String)
        End Sub
        Private Partial Sub OnPostalCodeChanged()
        End Sub
        Private Partial Sub OnRegionChanging(ByVal value As String)
        End Sub
        Private Partial Sub OnRegionChanged()
        End Sub

        #End Region
        
        
        ''' <summary>
        ''' Initializes a new instance of the <see cref="Customer"/> class.
        ''' </summary>
        Public Sub New()
            MyBase.New
            Me.OnCreated
        End Sub
        
        ''' <summary>
        ''' Gets or sets the 'Address' value.
        ''' </summary>
        <DataMember(),  _
         StringLength(60)>  _
        Public Property Address() As String
            Get
                Return Me._address
            End Get
            Set
                If (String.Equals(Me._address, value) = false) Then
                    Me.OnAddressChanging(value)
                    Me.RaiseDataMemberChanging("Address")
                    Me.ValidateProperty("Address", value)
                    Me._address = value
                    Me.RaiseDataMemberChanged("Address")
                    Me.OnAddressChanged
                End If
            End Set
        End Property
        
        ''' <summary>
        ''' Gets or sets the 'City' value.
        ''' </summary>
        <DataMember(),  _
         StringLength(15)>  _
        Public Property City() As String
            Get
                Return Me._city
            End Get
            Set
                If (String.Equals(Me._city, value) = false) Then
                    Me.OnCityChanging(value)
                    Me.RaiseDataMemberChanging("City")
                    Me.ValidateProperty("City", value)
                    Me._city = value
                    Me.RaiseDataMemberChanged("City")
                    Me.OnCityChanged
                End If
            End Set
        End Property
        
        ''' <summary>
        ''' Gets or sets the 'CompanyName' value.
        ''' </summary>
        <DataMember(),  _
         Required(),  _
         StringLength(40)>  _
        Public Property CompanyName() As String
            Get
                Return Me._companyName
            End Get
            Set
                If (String.Equals(Me._companyName, value) = false) Then
                    Me.OnCompanyNameChanging(value)
                    Me.RaiseDataMemberChanging("CompanyName")
                    Me.ValidateProperty("CompanyName", value)
                    Me._companyName = value
                    Me.RaiseDataMemberChanged("CompanyName")
                    Me.OnCompanyNameChanged
                End If
            End Set
        End Property
        
        ''' <summary>
        ''' Gets or sets the 'ContactName' value.
        ''' </summary>
        <DataMember(),  _
         StringLength(30)>  _
        Public Property ContactName() As String
            Get
                Return Me._contactName
            End Get
            Set
                If (String.Equals(Me._contactName, value) = false) Then
                    Me.OnContactNameChanging(value)
                    Me.RaiseDataMemberChanging("ContactName")
                    Me.ValidateProperty("ContactName", value)
                    Me._contactName = value
                    Me.RaiseDataMemberChanged("ContactName")
                    Me.OnContactNameChanged
                End If
            End Set
        End Property
        
        ''' <summary>
        ''' Gets or sets the 'ContactTitle' value.
        ''' </summary>
        <DataMember(),  _
         StringLength(30)>  _
        Public Property ContactTitle() As String
            Get
                Return Me._contactTitle
            End Get
            Set
                If (String.Equals(Me._contactTitle, value) = false) Then
                    Me.OnContactTitleChanging(value)
                    Me.RaiseDataMemberChanging("ContactTitle")
                    Me.ValidateProperty("ContactTitle", value)
                    Me._contactTitle = value
                    Me.RaiseDataMemberChanged("ContactTitle")
                    Me.OnContactTitleChanged
                End If
            End Set
        End Property
        
        ''' <summary>
        ''' Gets or sets the 'Country' value.
        ''' </summary>
        <DataMember(),  _
         StringLength(15)>  _
        Public Property Country() As String
            Get
                Return Me._country
            End Get
            Set
                If (String.Equals(Me._country, value) = false) Then
                    Me.OnCountryChanging(value)
                    Me.RaiseDataMemberChanging("Country")
                    Me.ValidateProperty("Country", value)
                    Me._country = value
                    Me.RaiseDataMemberChanged("Country")
                    Me.OnCountryChanged
                End If
            End Set
        End Property
        
        ''' <summary>
        ''' Gets or sets the 'CustomerID' value.
        ''' </summary>
        <DataMember(),  _
         Editable(false, AllowInitialValue:=true),  _
         Key(),  _
         Required(),  _
         RoundtripOriginal(),  _
         StringLength(5)>  _
        Public Property CustomerID() As String
            Get
                Return Me._customerID
            End Get
            Set
                If (String.Equals(Me._customerID, value) = false) Then
                    Me.OnCustomerIDChanging(value)
                    Me.ValidateProperty("CustomerID", value)
                    Me._customerID = value
                    Me.RaisePropertyChanged("CustomerID")
                    Me.OnCustomerIDChanged
                End If
            End Set
        End Property
        
        ''' <summary>
        ''' Gets or sets the 'Fax' value.
        ''' </summary>
        <DataMember(),  _
         StringLength(24)>  _
        Public Property Fax() As String
            Get
                Return Me._fax
            End Get
            Set
                If (String.Equals(Me._fax, value) = false) Then
                    Me.OnFaxChanging(value)
                    Me.RaiseDataMemberChanging("Fax")
                    Me.ValidateProperty("Fax", value)
                    Me._fax = value
                    Me.RaiseDataMemberChanged("Fax")
                    Me.OnFaxChanged
                End If
            End Set
        End Property
        
        ''' <summary>
        ''' Gets the collection of associated <see cref="Order"/> entity instances.
        ''' </summary>
        <Association("Customer_Order", "CustomerID", "CustomerID"),  _
         XmlIgnore()>  _
        Public ReadOnly Property Orders() As EntityCollection(Of Order)
            Get
                If (Me._orders Is Nothing) Then
                    Me._orders = New EntityCollection(Of Order)(Me, "Orders", AddressOf Me.FilterOrders, AddressOf Me.AttachOrders, AddressOf Me.DetachOrders)
                End If
                Return Me._orders
            End Get
        End Property
        
        ''' <summary>
        ''' Gets or sets the 'Phone' value.
        ''' </summary>
        <DataMember(),  _
         StringLength(24)>  _
        Public Property Phone() As String
            Get
                Return Me._phone
            End Get
            Set
                If (String.Equals(Me._phone, value) = false) Then
                    Me.OnPhoneChanging(value)
                    Me.RaiseDataMemberChanging("Phone")
                    Me.ValidateProperty("Phone", value)
                    Me._phone = value
                    Me.RaiseDataMemberChanged("Phone")
                    Me.OnPhoneChanged
                End If
            End Set
        End Property
        
        ''' <summary>
        ''' Gets or sets the 'PostalCode' value.
        ''' </summary>
        <DataMember(),  _
         StringLength(10)>  _
        Public Property PostalCode() As String
            Get
                Return Me._postalCode
            End Get
            Set
                If (String.Equals(Me._postalCode, value) = false) Then
                    Me.OnPostalCodeChanging(value)
                    Me.RaiseDataMemberChanging("PostalCode")
                    Me.ValidateProperty("PostalCode", value)
                    Me._postalCode = value
                    Me.RaiseDataMemberChanged("PostalCode")
                    Me.OnPostalCodeChanged
                End If
            End Set
        End Property
        
        ''' <summary>
        ''' Gets or sets the 'Region' value.
        ''' </summary>
        <DataMember(),  _
         StringLength(15)>  _
        Public Property Region() As String
            Get
                Return Me._region
            End Get
            Set
                If (String.Equals(Me._region, value) = false) Then
                    Me.OnRegionChanging(value)
                    Me.RaiseDataMemberChanging("Region")
                    Me.ValidateProperty("Region", value)
                    Me._region = value
                    Me.RaiseDataMemberChanged("Region")
                    Me.OnRegionChanged
                End If
            End Set
        End Property
        
        Private Sub AttachOrders(ByVal entity As Order)
            entity.Customer = Me
        End Sub
        
        Private Sub DetachOrders(ByVal entity As Order)
            entity.Customer = Nothing
        End Sub
        
        Private Function FilterOrders(ByVal entity As Order) As Boolean
            Return Object.Equals(entity.CustomerID, Me.CustomerID)
        End Function
        
        ''' <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 Overrides Function GetIdentity() As Object
            Return Me._customerID
        End Function
    End Class
    
    ''' <summary>
    ''' The DomainContext corresponding to the 'DomainService1' DomainService.
    ''' </summary>
    Partial Public NotInheritable Class DomainService1
        Inherits 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>
        Private Partial Sub OnCreated()
        End Sub

        #End Region
        
        
        ''' <summary>
        ''' Initializes a new instance of the <see cref="DomainService1"/> class.
        ''' </summary>
        Public Sub New()
            Me.New(New WebDomainClient(Of IDomainService1Contract)(New Uri("TransactionsSilverlight-Web-DomainService1.svc", UriKind.Relative)))
        End Sub
        
        ''' <summary>
        ''' Initializes a new instance of the <see cref="DomainService1"/> class with the specified service URI.
        ''' </summary>
        ''' <param name="serviceUri">The DomainService1 service URI.</param>
        Public Sub New(ByVal serviceUri As Uri)
            Me.New(New WebDomainClient(Of IDomainService1Contract)(serviceUri))
        End Sub
        
        ''' <summary>
        ''' Initializes a new instance of the <see cref="DomainService1"/> class with the specified <paramref name="domainClient"/>.
        ''' </summary>
        ''' <param name="domainClient">The DomainClient instance to use for this DomainContext.</param>
        Public Sub New(ByVal domainClient As DomainClient)
            MyBase.New(domainClient)
            Me.OnCreated
        End Sub
        
        ''' <summary>
        ''' Gets the set of <see cref="Customer"/> entity instances that have been loaded into this <see cref="DomainService1"/> instance.
        ''' </summary>
        Public ReadOnly Property Customers() As EntitySet(Of Customer)
            Get
                Return MyBase.EntityContainer.GetEntitySet(Of Customer)
            End Get
        End Property
        
        ''' <summary>
        ''' Gets the set of <see cref="Order_Detail"/> entity instances that have been loaded into this <see cref="DomainService1"/> instance.
        ''' </summary>
        Public ReadOnly Property Order_Details() As EntitySet(Of Order_Detail)
            Get
                Return MyBase.EntityContainer.GetEntitySet(Of Order_Detail)
            End Get
        End Property
        
        ''' <summary>
        ''' Gets the set of <see cref="Order"/> entity instances that have been loaded into this <see cref="DomainService1"/> instance.
        ''' </summary>
        Public ReadOnly Property Orders() As EntitySet(Of Order)
            Get
                Return MyBase.EntityContainer.GetEntitySet(Of Order)
            End Get
        End Property
        
        ''' <summary>
        ''' Gets an EntityQuery instance that can be used to load <see cref="Customer"/> entity instances using the 'GetCustomers' query.
        ''' </summary>
        ''' <returns>An EntityQuery that can be loaded to retrieve <see cref="Customer"/> entity instances.</returns>
        Public Function GetCustomersQuery() As EntityQuery(Of Customer)
            Me.ValidateMethod("GetCustomersQuery", Nothing)
            Return MyBase.CreateQuery(Of Customer)("GetCustomers", Nothing, false, true)
        End Function
        
        ''' <summary>
        ''' Gets an EntityQuery instance that can be used to load <see cref="Order_Detail"/> entity instances using the 'GetOrder_Details' query.
        ''' </summary>
        ''' <returns>An EntityQuery that can be loaded to retrieve <see cref="Order_Detail"/> entity instances.</returns>
        Public Function GetOrder_DetailsQuery() As EntityQuery(Of Order_Detail)
            Me.ValidateMethod("GetOrder_DetailsQuery", Nothing)
            Return MyBase.CreateQuery(Of Order_Detail)("GetOrder_Details", Nothing, false, true)
        End Function
        
        ''' <summary>
        ''' Gets an EntityQuery instance that can be used to load <see cref="Order"/> entity instances using the 'GetOrders' query.
        ''' </summary>
        ''' <returns>An EntityQuery that can be loaded to retrieve <see cref="Order"/> entity instances.</returns>
        Public Function GetOrdersQuery() As EntityQuery(Of Order)
            Me.ValidateMethod("GetOrdersQuery", Nothing)
            Return MyBase.CreateQuery(Of Order)("GetOrders", Nothing, false, true)
        End Function
        
        ''' <summary>
        ''' Creates a new EntityContainer for this DomainContext's EntitySets.
        ''' </summary>
        ''' <returns>A new container instance.</returns>
        Protected Overrides Function CreateEntityContainer() As EntityContainer
            Return New DomainService1EntityContainer()
        End Function
        
        ''' <summary>
        ''' Service contract for the 'DomainService1' DomainService.
        ''' </summary>
        <ServiceContract()>  _
        Public Interface IDomainService1Contract
            
            ''' <summary>
            ''' Asynchronously invokes the 'GetCustomers' 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(GetType(DomainServiceFault), Action:="http://tempuri.org/DomainService1/GetCustomersDomainServiceFault", Name:="DomainServiceFault", [Namespace]:="DomainServices"),  _
             OperationContract(AsyncPattern:=true, Action:="http://tempuri.org/DomainService1/GetCustomers", ReplyAction:="http://tempuri.org/DomainService1/GetCustomersResponse"),  _
             WebGet()>  _
            Function BeginGetCustomers(ByVal callback As AsyncCallback, ByVal asyncState As Object) As IAsyncResult
            
            ''' <summary>
            ''' Completes the asynchronous operation begun by 'BeginGetCustomers'.
            ''' </summary>
            ''' <param name="result">The IAsyncResult returned from 'BeginGetCustomers'.</param>
            ''' <returns>The 'QueryResult' returned from the 'GetCustomers' operation.</returns>
            Function EndGetCustomers(ByVal result As IAsyncResult) As QueryResult(Of Customer)
            
            ''' <summary>
            ''' Asynchronously invokes the 'GetOrder_Details' 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(GetType(DomainServiceFault), Action:="http://tempuri.org/DomainService1/GetOrder_DetailsDomainServiceFault", Name:="DomainServiceFault", [Namespace]:="DomainServices"),  _
             OperationContract(AsyncPattern:=true, Action:="http://tempuri.org/DomainService1/GetOrder_Details", ReplyAction:="http://tempuri.org/DomainService1/GetOrder_DetailsResponse"),  _
             WebGet()>  _
            Function BeginGetOrder_Details(ByVal callback As AsyncCallback, ByVal asyncState As Object) As IAsyncResult
            
            ''' <summary>
            ''' Completes the asynchronous operation begun by 'BeginGetOrder_Details'.
            ''' </summary>
            ''' <param name="result">The IAsyncResult returned from 'BeginGetOrder_Details'.</param>
            ''' <returns>The 'QueryResult' returned from the 'GetOrder_Details' operation.</returns>
            Function EndGetOrder_Details(ByVal result As IAsyncResult) As QueryResult(Of Order_Detail)
            
            ''' <summary>
            ''' Asynchronously invokes the 'GetOrders' 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(GetType(DomainServiceFault), Action:="http://tempuri.org/DomainService1/GetOrdersDomainServiceFault", Name:="DomainServiceFault", [Namespace]:="DomainServices"),  _
             OperationContract(AsyncPattern:=true, Action:="http://tempuri.org/DomainService1/GetOrders", ReplyAction:="http://tempuri.org/DomainService1/GetOrdersResponse"),  _
             WebGet()>  _
            Function BeginGetOrders(ByVal callback As AsyncCallback, ByVal asyncState As Object) As IAsyncResult
            
            ''' <summary>
            ''' Completes the asynchronous operation begun by 'BeginGetOrders'.
            ''' </summary>
            ''' <param name="result">The IAsyncResult returned from 'BeginGetOrders'.</param>
            ''' <returns>The 'QueryResult' returned from the 'GetOrders' operation.</returns>
            Function EndGetOrders(ByVal result As IAsyncResult) As QueryResult(Of Order)
            
            ''' <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(GetType(DomainServiceFault), Action:="http://tempuri.org/DomainService1/SubmitChangesDomainServiceFault", Name:="DomainServiceFault", [Namespace]:="DomainServices"),  _
             OperationContract(AsyncPattern:=true, Action:="http://tempuri.org/DomainService1/SubmitChanges", ReplyAction:="http://tempuri.org/DomainService1/SubmitChangesResponse")>  _
            Function BeginSubmitChanges(ByVal changeSet As IEnumerable(Of ChangeSetEntry), ByVal callback As AsyncCallback, ByVal asyncState As Object) As IAsyncResult
            
            ''' <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>
            Function EndSubmitChanges(ByVal result As IAsyncResult) As IEnumerable(Of ChangeSetEntry)
        End Interface
        
        Friend NotInheritable Class DomainService1EntityContainer
            Inherits EntityContainer
            
            Public Sub New()
                MyBase.New
                Me.CreateEntitySet(Of Customer)(EntitySetOperations.All)
                Me.CreateEntitySet(Of Order)(EntitySetOperations.All)
                Me.CreateEntitySet(Of Order_Detail)(EntitySetOperations.All)
            End Sub
        End Class
    End Class
    
    ''' <summary>
    ''' The 'Order' entity class.
    ''' </summary>
    <DataContract([Namespace]:="http://schemas.datacontract.org/2004/07/TransactionsSilverlight.Web")>  _
    Partial Public NotInheritable Class Order
        Inherits Entity
        
        Private _customer As EntityRef(Of Customer)
        
        Private _customerID As String
        
        Private _employeeID As Nullable(Of Integer)
        
        Private _freight As Nullable(Of Decimal)
        
        Private _order_Details As EntityCollection(Of Order_Detail)
        
        Private _orderDate As Nullable(Of DateTime)
        
        Private _orderID As Integer
        
        Private _requiredDate As Nullable(Of DateTime)
        
        Private _shipAddress As String
        
        Private _shipCity As String
        
        Private _shipCountry As String
        
        Private _shipName As String
        
        Private _shippedDate As Nullable(Of DateTime)
        
        Private _shipPostalCode As String
        
        Private _shipRegion As String
        
        Private _shipVia As Nullable(Of Integer)
        
        #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>
        Private Partial Sub OnCreated()
        End Sub
        Private Partial Sub OnCustomerIDChanging(ByVal value As String)
        End Sub
        Private Partial Sub OnCustomerIDChanged()
        End Sub
        Private Partial Sub OnEmployeeIDChanging(ByVal value As Nullable(Of Integer))
        End Sub
        Private Partial Sub OnEmployeeIDChanged()
        End Sub
        Private Partial Sub OnFreightChanging(ByVal value As Nullable(Of Decimal))
        End Sub
        Private Partial Sub OnFreightChanged()
        End Sub
        Private Partial Sub OnOrderDateChanging(ByVal value As Nullable(Of DateTime))
        End Sub
        Private Partial Sub OnOrderDateChanged()
        End Sub
        Private Partial Sub OnOrderIDChanging(ByVal value As Integer)
        End Sub
        Private Partial Sub OnOrderIDChanged()
        End Sub
        Private Partial Sub OnRequiredDateChanging(ByVal value As Nullable(Of DateTime))
        End Sub
        Private Partial Sub OnRequiredDateChanged()
        End Sub
        Private Partial Sub OnShipAddressChanging(ByVal value As String)
        End Sub
        Private Partial Sub OnShipAddressChanged()
        End Sub
        Private Partial Sub OnShipCityChanging(ByVal value As String)
        End Sub
        Private Partial Sub OnShipCityChanged()
        End Sub
        Private Partial Sub OnShipCountryChanging(ByVal value As String)
        End Sub
        Private Partial Sub OnShipCountryChanged()
        End Sub
        Private Partial Sub OnShipNameChanging(ByVal value As String)
        End Sub
        Private Partial Sub OnShipNameChanged()
        End Sub
        Private Partial Sub OnShippedDateChanging(ByVal value As Nullable(Of DateTime))
        End Sub
        Private Partial Sub OnShippedDateChanged()
        End Sub
        Private Partial Sub OnShipPostalCodeChanging(ByVal value As String)
        End Sub
        Private Partial Sub OnShipPostalCodeChanged()
        End Sub
        Private Partial Sub OnShipRegionChanging(ByVal value As String)
        End Sub
        Private Partial Sub OnShipRegionChanged()
        End Sub
        Private Partial Sub OnShipViaChanging(ByVal value As Nullable(Of Integer))
        End Sub
        Private Partial Sub OnShipViaChanged()
        End Sub

        #End Region
        
        
        ''' <summary>
        ''' Initializes a new instance of the <see cref="Order"/> class.
        ''' </summary>
        Public Sub New()
            MyBase.New
            Me.OnCreated
        End Sub
        
        ''' <summary>
        ''' Gets or sets the associated <see cref="Customer"/> entity.
        ''' </summary>
        <Association("Customer_Order", "CustomerID", "CustomerID", IsForeignKey:=true),  _
         XmlIgnore()>  _
        Public Property Customer() As Customer
            Get
                If (Me._customer Is Nothing) Then
                    Me._customer = New EntityRef(Of Customer)(Me, "Customer", AddressOf Me.FilterCustomer)
                End If
                Return Me._customer.Entity
            End Get
            Set
                Dim previous As Customer = Me.Customer
                If (Object.Equals(previous, value) = false) Then
                    Me.ValidateProperty("Customer", value)
                    If (Not (previous) Is Nothing) Then
                        Me._customer.Entity = Nothing
                        previous.Orders.Remove(Me)
                    End If
                    If (Not (value) Is Nothing) Then
                        Me.CustomerID = value.CustomerID
                    Else
                        Me.CustomerID = CType(Nothing, String)
                    End If
                    Me._customer.Entity = value
                    If (Not (value) Is Nothing) Then
                        value.Orders.Add(Me)
                    End If
                    Me.RaisePropertyChanged("Customer")
                End If
            End Set
        End Property
        
        ''' <summary>
        ''' Gets or sets the 'CustomerID' value.
        ''' </summary>
        <DataMember(),  _
         RoundtripOriginal(),  _
         StringLength(5)>  _
        Public Property CustomerID() As String
            Get
                Return Me._customerID
            End Get
            Set
                If (String.Equals(Me._customerID, value) = false) Then
                    Me.OnCustomerIDChanging(value)
                    Me.RaiseDataMemberChanging("CustomerID")
                    Me.ValidateProperty("CustomerID", value)
                    Me._customerID = value
                    Me.RaiseDataMemberChanged("CustomerID")
                    Me.OnCustomerIDChanged
                End If
            End Set
        End Property
        
        ''' <summary>
        ''' Gets or sets the 'EmployeeID' value.
        ''' </summary>
        <DataMember()>  _
        Public Property EmployeeID() As Nullable(Of Integer)
            Get
                Return Me._employeeID
            End Get
            Set
                If (Me._employeeID.Equals(value) = false) Then
                    Me.OnEmployeeIDChanging(value)
                    Me.RaiseDataMemberChanging("EmployeeID")
                    Me.ValidateProperty("EmployeeID", value)
                    Me._employeeID = value
                    Me.RaiseDataMemberChanged("EmployeeID")
                    Me.OnEmployeeIDChanged
                End If
            End Set
        End Property
        
        ''' <summary>
        ''' Gets or sets the 'Freight' value.
        ''' </summary>
        <DataMember()>  _
        Public Property Freight() As Nullable(Of Decimal)
            Get
                Return Me._freight
            End Get
            Set
                If (Me._freight.Equals(value) = false) Then
                    Me.OnFreightChanging(value)
                    Me.RaiseDataMemberChanging("Freight")
                    Me.ValidateProperty("Freight", value)
                    Me._freight = value
                    Me.RaiseDataMemberChanged("Freight")
                    Me.OnFreightChanged
                End If
            End Set
        End Property
        
        ''' <summary>
        ''' Gets the collection of associated <see cref="Order_Detail"/> entity instances.
        ''' </summary>
        <Association("Order_Order_Detail", "OrderID", "OrderID"),  _
         XmlIgnore()>  _
        Public ReadOnly Property Order_Details() As EntityCollection(Of Order_Detail)
            Get
                If (Me._order_Details Is Nothing) Then
                    Me._order_Details = New EntityCollection(Of Order_Detail)(Me, "Order_Details", AddressOf Me.FilterOrder_Details, AddressOf Me.AttachOrder_Details, AddressOf Me.DetachOrder_Details)
                End If
                Return Me._order_Details
            End Get
        End Property
        
        ''' <summary>
        ''' Gets or sets the 'OrderDate' value.
        ''' </summary>
        <DataMember()>  _
        Public Property OrderDate() As Nullable(Of DateTime)
            Get
                Return Me._orderDate
            End Get
            Set
                If (Me._orderDate.Equals(value) = false) Then
                    Me.OnOrderDateChanging(value)
                    Me.RaiseDataMemberChanging("OrderDate")
                    Me.ValidateProperty("OrderDate", value)
                    Me._orderDate = value
                    Me.RaiseDataMemberChanged("OrderDate")
                    Me.OnOrderDateChanged
                End If
            End Set
        End Property
        
        ''' <summary>
        ''' Gets or sets the 'OrderID' value.
        ''' </summary>
        <DataMember(),  _
         Editable(false, AllowInitialValue:=true),  _
         Key(),  _
         RoundtripOriginal()>  _
        Public Property OrderID() As Integer
            Get
                Return Me._orderID
            End Get
            Set
                If ((Me._orderID = value)  _
                            = false) Then
                    Me.OnOrderIDChanging(value)
                    Me.ValidateProperty("OrderID", value)
                    Me._orderID = value
                    Me.RaisePropertyChanged("OrderID")
                    Me.OnOrderIDChanged
                End If
            End Set
        End Property
        
        ''' <summary>
        ''' Gets or sets the 'RequiredDate' value.
        ''' </summary>
        <DataMember()>  _
        Public Property RequiredDate() As Nullable(Of DateTime)
            Get
                Return Me._requiredDate
            End Get
            Set
                If (Me._requiredDate.Equals(value) = false) Then
                    Me.OnRequiredDateChanging(value)
                    Me.RaiseDataMemberChanging("RequiredDate")
                    Me.ValidateProperty("RequiredDate", value)
                    Me._requiredDate = value
                    Me.RaiseDataMemberChanged("RequiredDate")
                    Me.OnRequiredDateChanged
                End If
            End Set
        End Property
        
        ''' <summary>
        ''' Gets or sets the 'ShipAddress' value.
        ''' </summary>
        <DataMember(),  _
         StringLength(60)>  _
        Public Property ShipAddress() As String
            Get
                Return Me._shipAddress
            End Get
            Set
                If (String.Equals(Me._shipAddress, value) = false) Then
                    Me.OnShipAddressChanging(value)
                    Me.RaiseDataMemberChanging("ShipAddress")
                    Me.ValidateProperty("ShipAddress", value)
                    Me._shipAddress = value
                    Me.RaiseDataMemberChanged("ShipAddress")
                    Me.OnShipAddressChanged
                End If
            End Set
        End Property
        
        ''' <summary>
        ''' Gets or sets the 'ShipCity' value.
        ''' </summary>
        <DataMember(),  _
         StringLength(15)>  _
        Public Property ShipCity() As String
            Get
                Return Me._shipCity
            End Get
            Set
                If (String.Equals(Me._shipCity, value) = false) Then
                    Me.OnShipCityChanging(value)
                    Me.RaiseDataMemberChanging("ShipCity")
                    Me.ValidateProperty("ShipCity", value)
                    Me._shipCity = value
                    Me.RaiseDataMemberChanged("ShipCity")
                    Me.OnShipCityChanged
                End If
            End Set
        End Property
        
        ''' <summary>
        ''' Gets or sets the 'ShipCountry' value.
        ''' </summary>
        <DataMember(),  _
         StringLength(15)>  _
        Public Property ShipCountry() As String
            Get
                Return Me._shipCountry
            End Get
            Set
                If (String.Equals(Me._shipCountry, value) = false) Then
                    Me.OnShipCountryChanging(value)
                    Me.RaiseDataMemberChanging("ShipCountry")
                    Me.ValidateProperty("ShipCountry", value)
                    Me._shipCountry = value
                    Me.RaiseDataMemberChanged("ShipCountry")
                    Me.OnShipCountryChanged
                End If
            End Set
        End Property
        
        ''' <summary>
        ''' Gets or sets the 'ShipName' value.
        ''' </summary>
        <DataMember(),  _
         StringLength(40)>  _
        Public Property ShipName() As String
            Get
                Return Me._shipName
            End Get
            Set
                If (String.Equals(Me._shipName, value) = false) Then
                    Me.OnShipNameChanging(value)
                    Me.RaiseDataMemberChanging("ShipName")
                    Me.ValidateProperty("ShipName", value)
                    Me._shipName = value
                    Me.RaiseDataMemberChanged("ShipName")
                    Me.OnShipNameChanged
                End If
            End Set
        End Property
        
        ''' <summary>
        ''' Gets or sets the 'ShippedDate' value.
        ''' </summary>
        <DataMember()>  _
        Public Property ShippedDate() As Nullable(Of DateTime)
            Get
                Return Me._shippedDate
            End Get
            Set
                If (Me._shippedDate.Equals(value) = false) Then
                    Me.OnShippedDateChanging(value)
                    Me.RaiseDataMemberChanging("ShippedDate")
                    Me.ValidateProperty("ShippedDate", value)
                    Me._shippedDate = value
                    Me.RaiseDataMemberChanged("ShippedDate")
                    Me.OnShippedDateChanged
                End If
            End Set
        End Property
        
        ''' <summary>
        ''' Gets or sets the 'ShipPostalCode' value.
        ''' </summary>
        <DataMember(),  _
         StringLength(10)>  _
        Public Property ShipPostalCode() As String
            Get
                Return Me._shipPostalCode
            End Get
            Set
                If (String.Equals(Me._shipPostalCode, value) = false) Then
                    Me.OnShipPostalCodeChanging(value)
                    Me.RaiseDataMemberChanging("ShipPostalCode")
                    Me.ValidateProperty("ShipPostalCode", value)
                    Me._shipPostalCode = value
                    Me.RaiseDataMemberChanged("ShipPostalCode")
                    Me.OnShipPostalCodeChanged
                End If
            End Set
        End Property
        
        ''' <summary>
        ''' Gets or sets the 'ShipRegion' value.
        ''' </summary>
        <DataMember(),  _
         StringLength(15)>  _
        Public Property ShipRegion() As String
            Get
                Return Me._shipRegion
            End Get
            Set
                If (String.Equals(Me._shipRegion, value) = false) Then
                    Me.OnShipRegionChanging(value)
                    Me.RaiseDataMemberChanging("ShipRegion")
                    Me.ValidateProperty("ShipRegion", value)
                    Me._shipRegion = value
                    Me.RaiseDataMemberChanged("ShipRegion")
                    Me.OnShipRegionChanged
                End If
            End Set
        End Property
        
        ''' <summary>
        ''' Gets or sets the 'ShipVia' value.
        ''' </summary>
        <DataMember()>  _
        Public Property ShipVia() As Nullable(Of Integer)
            Get
                Return Me._shipVia
            End Get
            Set
                If (Me._shipVia.Equals(value) = false) Then
                    Me.OnShipViaChanging(value)
                    Me.RaiseDataMemberChanging("ShipVia")
                    Me.ValidateProperty("ShipVia", value)
                    Me._shipVia = value
                    Me.RaiseDataMemberChanged("ShipVia")
                    Me.OnShipViaChanged
                End If
            End Set
        End Property
        
        Private Function FilterCustomer(ByVal entity As Customer) As Boolean
            Return Object.Equals(entity.CustomerID, Me.CustomerID)
        End Function
        
        Private Sub AttachOrder_Details(ByVal entity As Order_Detail)
            entity.Order = Me
        End Sub
        
        Private Sub DetachOrder_Details(ByVal entity As Order_Detail)
            entity.Order = Nothing
        End Sub
        
        Private Function FilterOrder_Details(ByVal entity As Order_Detail) As Boolean
            Return Object.Equals(entity.OrderID, Me.OrderID)
        End Function
        
        ''' <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 Overrides Function GetIdentity() As Object
            Return Me._orderID
        End Function
    End Class
    
    ''' <summary>
    ''' The 'Order_Detail' entity class.
    ''' </summary>
    <DataContract([Namespace]:="http://schemas.datacontract.org/2004/07/TransactionsSilverlight.Web")>  _
    Partial Public NotInheritable Class Order_Detail
        Inherits Entity
        
        Private _discount As Single
        
        Private _order As EntityRef(Of Order)
        
        Private _orderID As Integer
        
        Private _productID As Integer
        
        Private _quantity As Short
        
        Private _unitPrice As Decimal
        
        #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>
        Private Partial Sub OnCreated()
        End Sub
        Private Partial Sub OnDiscountChanging(ByVal value As Single)
        End Sub
        Private Partial Sub OnDiscountChanged()
        End Sub
        Private Partial Sub OnOrderIDChanging(ByVal value As Integer)
        End Sub
        Private Partial Sub OnOrderIDChanged()
        End Sub
        Private Partial Sub OnProductIDChanging(ByVal value As Integer)
        End Sub
        Private Partial Sub OnProductIDChanged()
        End Sub
        Private Partial Sub OnQuantityChanging(ByVal value As Short)
        End Sub
        Private Partial Sub OnQuantityChanged()
        End Sub
        Private Partial Sub OnUnitPriceChanging(ByVal value As Decimal)
        End Sub
        Private Partial Sub OnUnitPriceChanged()
        End Sub

        #End Region
        
        
        ''' <summary>
        ''' Initializes a new instance of the <see cref="Order_Detail"/> class.
        ''' </summary>
        Public Sub New()
            MyBase.New
            Me.OnCreated
        End Sub
        
        ''' <summary>
        ''' Gets or sets the 'Discount' value.
        ''' </summary>
        <DataMember()>  _
        Public Property Discount() As Single
            Get
                Return Me._discount
            End Get
            Set
                If ((Me._discount = value)  _
                            = false) Then
                    Me.OnDiscountChanging(value)
                    Me.RaiseDataMemberChanging("Discount")
                    Me.ValidateProperty("Discount", value)
                    Me._discount = value
                    Me.RaiseDataMemberChanged("Discount")
                    Me.OnDiscountChanged
                End If
            End Set
        End Property
        
        ''' <summary>
        ''' Gets or sets the associated <see cref="Order"/> entity.
        ''' </summary>
        <Association("Order_Order_Detail", "OrderID", "OrderID", IsForeignKey:=true),  _
         XmlIgnore()>  _
        Public Property Order() As Order
            Get
                If (Me._order Is Nothing) Then
                    Me._order = New EntityRef(Of Order)(Me, "Order", AddressOf Me.FilterOrder)
                End If
                Return Me._order.Entity
            End Get
            Set
                Dim previous As Order = Me.Order
                If (Object.Equals(previous, value) = false) Then
                    Me.ValidateProperty("Order", value)
                    If (Not (previous) Is Nothing) Then
                        Me._order.Entity = Nothing
                        previous.Order_Details.Remove(Me)
                    End If
                    If (Not (value) Is Nothing) Then
                        Me.OrderID = value.OrderID
                    Else
                        Me.OrderID = CType(Nothing, Integer)
                    End If
                    Me._order.Entity = value
                    If (Not (value) Is Nothing) Then
                        value.Order_Details.Add(Me)
                    End If
                    Me.RaisePropertyChanged("Order")
                End If
            End Set
        End Property
        
        ''' <summary>
        ''' Gets or sets the 'OrderID' value.
        ''' </summary>
        <DataMember(),  _
         Key(),  _
         RoundtripOriginal()>  _
        Public Property OrderID() As Integer
            Get
                Return Me._orderID
            End Get
            Set
                If ((Me._orderID = value)  _
                            = false) Then
                    Me.OnOrderIDChanging(value)
                    Me.RaiseDataMemberChanging("OrderID")
                    Me.ValidateProperty("OrderID", value)
                    Me._orderID = value
                    Me.RaiseDataMemberChanged("OrderID")
                    Me.OnOrderIDChanged
                End If
            End Set
        End Property
        
        ''' <summary>
        ''' Gets or sets the 'ProductID' value.
        ''' </summary>
        <DataMember(),  _
         Key(),  _
         RoundtripOriginal()>  _
        Public Property ProductID() As Integer
            Get
                Return Me._productID
            End Get
            Set
                If ((Me._productID = value)  _
                            = false) Then
                    Me.OnProductIDChanging(value)
                    Me.RaiseDataMemberChanging("ProductID")
                    Me.ValidateProperty("ProductID", value)
                    Me._productID = value
                    Me.RaiseDataMemberChanged("ProductID")
                    Me.OnProductIDChanged
                End If
            End Set
        End Property
        
        ''' <summary>
        ''' Gets or sets the 'Quantity' value.
        ''' </summary>
        <DataMember()>  _
        Public Property Quantity() As Short
            Get
                Return Me._quantity
            End Get
            Set
                If ((Me._quantity = value)  _
                            = false) Then
                    Me.OnQuantityChanging(value)
                    Me.RaiseDataMemberChanging("Quantity")
                    Me.ValidateProperty("Quantity", value)
                    Me._quantity = value
                    Me.RaiseDataMemberChanged("Quantity")
                    Me.OnQuantityChanged
                End If
            End Set
        End Property
        
        ''' <summary>
        ''' Gets or sets the 'UnitPrice' value.
        ''' </summary>
        <DataMember()>  _
        Public Property UnitPrice() As Decimal
            Get
                Return Me._unitPrice
            End Get
            Set
                If ((Me._unitPrice = value)  _
                            = false) Then
                    Me.OnUnitPriceChanging(value)
                    Me.RaiseDataMemberChanging("UnitPrice")
                    Me.ValidateProperty("UnitPrice", value)
                    Me._unitPrice = value
                    Me.RaiseDataMemberChanged("UnitPrice")
                    Me.OnUnitPriceChanged
                End If
            End Set
        End Property
        
        Private Function FilterOrder(ByVal entity As Order) As Boolean
            Return Object.Equals(entity.OrderID, Me.OrderID)
        End Function
        
        ''' <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 Overrides Function GetIdentity() As Object
            Return EntityKey.Create(Me._orderID, Me._productID)
        End Function
    End Class
End Namespace
