Click here to Skip to main content
15,886,137 members
Articles / Desktop Programming / Windows Forms

Entity Framework in WinForms

Rate me:
Please Sign up or sign in to vote.
4.89/5 (142 votes)
28 Jul 2014CPOL29 min read 947K   58.1K   425  
A component that makes it easy to use Entity Framework in WinForms projects, including design-time binding support.

'------------------------------------------------------------------------------
' <auto-generated>
'    This code was generated from a template.
'
'    Manual changes to this file may cause unexpected behavior in your application.
'    Manual changes to this file will be overwritten if the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------

Imports System
Imports System.Data.Objects
Imports System.Data.Objects.DataClasses
Imports System.Data.EntityClient
Imports System.ComponentModel
Imports System.Xml.Serialization
Imports System.Runtime.Serialization

<Assembly: EdmSchemaAttribute("e142cc29-ac3c-407a-89d7-c2bc4cd44c36")>
#Region "EDM Relationship Metadata"
<Assembly: EdmRelationshipAttribute("northwndModel", "FK_Products_Categories", "Categories", System.Data.Metadata.Edm.RelationshipMultiplicity.ZeroOrOne, GetType(Category), "Products", System.Data.Metadata.Edm.RelationshipMultiplicity.Many, GetType(Product), True)>
<Assembly: EdmRelationshipAttribute("northwndModel", "FK_Orders_Customers", "Customers", System.Data.Metadata.Edm.RelationshipMultiplicity.ZeroOrOne, GetType(Customer), "Orders", System.Data.Metadata.Edm.RelationshipMultiplicity.Many, GetType(Order), True)>
<Assembly: EdmRelationshipAttribute("northwndModel", "FK_Employees_Employees", "Employees", System.Data.Metadata.Edm.RelationshipMultiplicity.ZeroOrOne, GetType(Employee), "Employees1", System.Data.Metadata.Edm.RelationshipMultiplicity.Many, GetType(Employee), True)>
<Assembly: EdmRelationshipAttribute("northwndModel", "FK_Orders_Employees", "Employees", System.Data.Metadata.Edm.RelationshipMultiplicity.ZeroOrOne, GetType(Employee), "Orders", System.Data.Metadata.Edm.RelationshipMultiplicity.Many, GetType(Order), True)>
<Assembly: EdmRelationshipAttribute("northwndModel", "FK_Order_Details_Orders", "Orders", System.Data.Metadata.Edm.RelationshipMultiplicity.One, GetType(Order), "Order_Details", System.Data.Metadata.Edm.RelationshipMultiplicity.Many, GetType(Order_Detail), True)>
<Assembly: EdmRelationshipAttribute("northwndModel", "FK_Order_Details_Products", "Products", System.Data.Metadata.Edm.RelationshipMultiplicity.One, GetType(Product), "Order_Details", System.Data.Metadata.Edm.RelationshipMultiplicity.Many, GetType(Order_Detail), True)>
<Assembly: EdmRelationshipAttribute("northwndModel", "FK_Orders_Shippers", "Shippers", System.Data.Metadata.Edm.RelationshipMultiplicity.ZeroOrOne, GetType(Shipper), "Orders", System.Data.Metadata.Edm.RelationshipMultiplicity.Many, GetType(Order), True)>
<Assembly: EdmRelationshipAttribute("northwndModel", "FK_Products_Suppliers", "Suppliers", System.Data.Metadata.Edm.RelationshipMultiplicity.ZeroOrOne, GetType(Supplier), "Products", System.Data.Metadata.Edm.RelationshipMultiplicity.Many, GetType(Product), True)>
<Assembly: EdmRelationshipAttribute("northwndModel", "FK_Territories_Region", "Region", System.Data.Metadata.Edm.RelationshipMultiplicity.One, GetType(Region), "Territories", System.Data.Metadata.Edm.RelationshipMultiplicity.Many, GetType(Territory), True)>
<Assembly: EdmRelationshipAttribute("northwndModel", "CustomerCustomerDemo", "CustomerDemographics", System.Data.Metadata.Edm.RelationshipMultiplicity.Many, GetType(CustomerDemographic), "Customers", System.Data.Metadata.Edm.RelationshipMultiplicity.Many, GetType(Customer))>
<Assembly: EdmRelationshipAttribute("northwndModel", "EmployeeTerritories", "Employees", System.Data.Metadata.Edm.RelationshipMultiplicity.Many, GetType(Employee), "Territories", System.Data.Metadata.Edm.RelationshipMultiplicity.Many, GetType(Territory))>

#End Region

#Region "Contexts"

''' <summary>
''' No Metadata Documentation available.
''' </summary>
Public Partial Class northwndEntities
    Inherits ObjectContext

    #Region "Constructors"

    ''' <summary>
    ''' Initializes a new northwndEntities object using the connection string found in the 'northwndEntities' section of the application configuration file.
    ''' </summary>
    Public Sub New()
        MyBase.New("name=northwndEntities", "northwndEntities")
    MyBase.ContextOptions.LazyLoadingEnabled = true
        OnContextCreated()
    End Sub

    ''' <summary>
    ''' Initialize a new northwndEntities object.
    ''' </summary>
    Public Sub New(ByVal connectionString As String)
        MyBase.New(connectionString, "northwndEntities")
    MyBase.ContextOptions.LazyLoadingEnabled = true
        OnContextCreated()
    End Sub

    ''' <summary>
    ''' Initialize a new northwndEntities object.
    ''' </summary>
    Public Sub New(ByVal connection As EntityConnection)
        MyBase.New(connection, "northwndEntities")
    MyBase.ContextOptions.LazyLoadingEnabled = true
        OnContextCreated()
    End Sub

    #End Region

    #Region "Partial Methods"

    Partial Private Sub OnContextCreated()
    End Sub

    #End Region

    #Region "ObjectSet Properties"

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    Public ReadOnly Property Categories() As ObjectSet(Of Category)
        Get
            If (_Categories Is Nothing) Then
                _Categories = MyBase.CreateObjectSet(Of Category)("Categories")
            End If
            Return _Categories
        End Get
    End Property

    Private _Categories As ObjectSet(Of Category)

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    Public ReadOnly Property CustomerDemographics() As ObjectSet(Of CustomerDemographic)
        Get
            If (_CustomerDemographics Is Nothing) Then
                _CustomerDemographics = MyBase.CreateObjectSet(Of CustomerDemographic)("CustomerDemographics")
            End If
            Return _CustomerDemographics
        End Get
    End Property

    Private _CustomerDemographics As ObjectSet(Of CustomerDemographic)

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    Public ReadOnly Property Customers() As ObjectSet(Of Customer)
        Get
            If (_Customers Is Nothing) Then
                _Customers = MyBase.CreateObjectSet(Of Customer)("Customers")
            End If
            Return _Customers
        End Get
    End Property

    Private _Customers As ObjectSet(Of Customer)

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    Public ReadOnly Property Employees() As ObjectSet(Of Employee)
        Get
            If (_Employees Is Nothing) Then
                _Employees = MyBase.CreateObjectSet(Of Employee)("Employees")
            End If
            Return _Employees
        End Get
    End Property

    Private _Employees As ObjectSet(Of Employee)

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    Public ReadOnly Property Order_Details() As ObjectSet(Of Order_Detail)
        Get
            If (_Order_Details Is Nothing) Then
                _Order_Details = MyBase.CreateObjectSet(Of Order_Detail)("Order_Details")
            End If
            Return _Order_Details
        End Get
    End Property

    Private _Order_Details As ObjectSet(Of Order_Detail)

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    Public ReadOnly Property Orders() As ObjectSet(Of Order)
        Get
            If (_Orders Is Nothing) Then
                _Orders = MyBase.CreateObjectSet(Of Order)("Orders")
            End If
            Return _Orders
        End Get
    End Property

    Private _Orders As ObjectSet(Of Order)

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    Public ReadOnly Property Products() As ObjectSet(Of Product)
        Get
            If (_Products Is Nothing) Then
                _Products = MyBase.CreateObjectSet(Of Product)("Products")
            End If
            Return _Products
        End Get
    End Property

    Private _Products As ObjectSet(Of Product)

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    Public ReadOnly Property Regions() As ObjectSet(Of Region)
        Get
            If (_Regions Is Nothing) Then
                _Regions = MyBase.CreateObjectSet(Of Region)("Regions")
            End If
            Return _Regions
        End Get
    End Property

    Private _Regions As ObjectSet(Of Region)

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    Public ReadOnly Property Shippers() As ObjectSet(Of Shipper)
        Get
            If (_Shippers Is Nothing) Then
                _Shippers = MyBase.CreateObjectSet(Of Shipper)("Shippers")
            End If
            Return _Shippers
        End Get
    End Property

    Private _Shippers As ObjectSet(Of Shipper)

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    Public ReadOnly Property Suppliers() As ObjectSet(Of Supplier)
        Get
            If (_Suppliers Is Nothing) Then
                _Suppliers = MyBase.CreateObjectSet(Of Supplier)("Suppliers")
            End If
            Return _Suppliers
        End Get
    End Property

    Private _Suppliers As ObjectSet(Of Supplier)

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    Public ReadOnly Property Territories() As ObjectSet(Of Territory)
        Get
            If (_Territories Is Nothing) Then
                _Territories = MyBase.CreateObjectSet(Of Territory)("Territories")
            End If
            Return _Territories
        End Get
    End Property

    Private _Territories As ObjectSet(Of Territory)

    #End Region
    #Region "AddTo Methods"

    ''' <summary>
    ''' Deprecated Method for adding a new object to the Categories EntitySet. Consider using the .Add method of the associated ObjectSet(Of T) property instead.
    ''' </summary>
    Public Sub AddToCategories(ByVal category As Category)
        MyBase.AddObject("Categories", category)
    End Sub

    ''' <summary>
    ''' Deprecated Method for adding a new object to the CustomerDemographics EntitySet. Consider using the .Add method of the associated ObjectSet(Of T) property instead.
    ''' </summary>
    Public Sub AddToCustomerDemographics(ByVal customerDemographic As CustomerDemographic)
        MyBase.AddObject("CustomerDemographics", customerDemographic)
    End Sub

    ''' <summary>
    ''' Deprecated Method for adding a new object to the Customers EntitySet. Consider using the .Add method of the associated ObjectSet(Of T) property instead.
    ''' </summary>
    Public Sub AddToCustomers(ByVal customer As Customer)
        MyBase.AddObject("Customers", customer)
    End Sub

    ''' <summary>
    ''' Deprecated Method for adding a new object to the Employees EntitySet. Consider using the .Add method of the associated ObjectSet(Of T) property instead.
    ''' </summary>
    Public Sub AddToEmployees(ByVal employee As Employee)
        MyBase.AddObject("Employees", employee)
    End Sub

    ''' <summary>
    ''' Deprecated Method for adding a new object to the Order_Details EntitySet. Consider using the .Add method of the associated ObjectSet(Of T) property instead.
    ''' </summary>
    Public Sub AddToOrder_Details(ByVal order_Detail As Order_Detail)
        MyBase.AddObject("Order_Details", order_Detail)
    End Sub

    ''' <summary>
    ''' Deprecated Method for adding a new object to the Orders EntitySet. Consider using the .Add method of the associated ObjectSet(Of T) property instead.
    ''' </summary>
    Public Sub AddToOrders(ByVal order As Order)
        MyBase.AddObject("Orders", order)
    End Sub

    ''' <summary>
    ''' Deprecated Method for adding a new object to the Products EntitySet. Consider using the .Add method of the associated ObjectSet(Of T) property instead.
    ''' </summary>
    Public Sub AddToProducts(ByVal product As Product)
        MyBase.AddObject("Products", product)
    End Sub

    ''' <summary>
    ''' Deprecated Method for adding a new object to the Regions EntitySet. Consider using the .Add method of the associated ObjectSet(Of T) property instead.
    ''' </summary>
    Public Sub AddToRegions(ByVal region As Region)
        MyBase.AddObject("Regions", region)
    End Sub

    ''' <summary>
    ''' Deprecated Method for adding a new object to the Shippers EntitySet. Consider using the .Add method of the associated ObjectSet(Of T) property instead.
    ''' </summary>
    Public Sub AddToShippers(ByVal shipper As Shipper)
        MyBase.AddObject("Shippers", shipper)
    End Sub

    ''' <summary>
    ''' Deprecated Method for adding a new object to the Suppliers EntitySet. Consider using the .Add method of the associated ObjectSet(Of T) property instead.
    ''' </summary>
    Public Sub AddToSuppliers(ByVal supplier As Supplier)
        MyBase.AddObject("Suppliers", supplier)
    End Sub

    ''' <summary>
    ''' Deprecated Method for adding a new object to the Territories EntitySet. Consider using the .Add method of the associated ObjectSet(Of T) property instead.
    ''' </summary>
    Public Sub AddToTerritories(ByVal territory As Territory)
        MyBase.AddObject("Territories", territory)
    End Sub

    #End Region
End Class

#End Region
#Region "Entities"

''' <summary>
''' No Metadata Documentation available.
''' </summary>
<EdmEntityTypeAttribute(NamespaceName:="northwndModel", Name:="Category")>
<Serializable()>
<DataContractAttribute(IsReference:=True)>
Public Partial Class Category
    Inherits EntityObject
    #Region "Factory Method"

    ''' <summary>
    ''' Create a new Category object.
    ''' </summary>
    ''' <param name="categoryID">Initial value of the CategoryID property.</param>
    ''' <param name="categoryName">Initial value of the CategoryName property.</param>
    Public Shared Function CreateCategory(categoryID As Global.System.Int32, categoryName As Global.System.String) As Category
        Dim category as Category = New Category
        category.CategoryID = categoryID
        category.CategoryName = categoryName
        Return category
    End Function

    #End Region
    #Region "Primitive Properties"

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=true, IsNullable:=false)>
    <DataMemberAttribute()>
    Public Property CategoryID() As Global.System.Int32
        Get
            Return _CategoryID
        End Get
        Set
            If (_CategoryID <> Value) Then
                OnCategoryIDChanging(value)
                ReportPropertyChanging("CategoryID")
                _CategoryID = StructuralObject.SetValidValue(value)
                ReportPropertyChanged("CategoryID")
                OnCategoryIDChanged()
            End If
        End Set
    End Property

    Private _CategoryID As Global.System.Int32
    Private Partial Sub OnCategoryIDChanging(value As Global.System.Int32)
    End Sub

    Private Partial Sub OnCategoryIDChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=false)>
    <DataMemberAttribute()>
    Public Property CategoryName() As Global.System.String
        Get
            Return _CategoryName
        End Get
        Set
            OnCategoryNameChanging(value)
            ReportPropertyChanging("CategoryName")
            _CategoryName = StructuralObject.SetValidValue(value, false)
            ReportPropertyChanged("CategoryName")
            OnCategoryNameChanged()
        End Set
    End Property

    Private _CategoryName As Global.System.String
    Private Partial Sub OnCategoryNameChanging(value As Global.System.String)
    End Sub

    Private Partial Sub OnCategoryNameChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=true)>
    <DataMemberAttribute()>
    Public Property Description() As Global.System.String
        Get
            Return _Description
        End Get
        Set
            OnDescriptionChanging(value)
            ReportPropertyChanging("Description")
            _Description = StructuralObject.SetValidValue(value, true)
            ReportPropertyChanged("Description")
            OnDescriptionChanged()
        End Set
    End Property

    Private _Description As Global.System.String
    Private Partial Sub OnDescriptionChanging(value As Global.System.String)
    End Sub

    Private Partial Sub OnDescriptionChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=true)>
    <DataMemberAttribute()>
    Public Property Picture() As Global.System.Byte()
        Get
                Return StructuralObject.GetValidValue(_Picture)
        End Get
        Set
            OnPictureChanging(value)
            ReportPropertyChanging("Picture")
            _Picture = StructuralObject.SetValidValue(value, true)
            ReportPropertyChanged("Picture")
            OnPictureChanged()
        End Set
    End Property

    Private _Picture As Global.System.Byte()
    Private Partial Sub OnPictureChanging(value As Global.System.Byte())
    End Sub

    Private Partial Sub OnPictureChanged()
    End Sub

    #End Region
    #Region "Navigation Properties"

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <XmlIgnoreAttribute()>
    <SoapIgnoreAttribute()>
    <DataMemberAttribute()>
    <EdmRelationshipNavigationPropertyAttribute("northwndModel", "FK_Products_Categories", "Products")>
     Public Property Products() As EntityCollection(Of Product)
        Get
            Return CType(Me,IEntityWithRelationships).RelationshipManager.GetRelatedCollection(Of Product)("northwndModel.FK_Products_Categories", "Products")
        End Get
        Set
            If (Not value Is Nothing)
                CType(Me, IEntityWithRelationships).RelationshipManager.InitializeRelatedCollection(Of Product)("northwndModel.FK_Products_Categories", "Products", value)
            End If
        End Set
    End Property

    #End Region
End Class

''' <summary>
''' No Metadata Documentation available.
''' </summary>
<EdmEntityTypeAttribute(NamespaceName:="northwndModel", Name:="Customer")>
<Serializable()>
<DataContractAttribute(IsReference:=True)>
Public Partial Class Customer
    Inherits EntityObject
    #Region "Factory Method"

    ''' <summary>
    ''' Create a new Customer object.
    ''' </summary>
    ''' <param name="customerID">Initial value of the CustomerID property.</param>
    ''' <param name="companyName">Initial value of the CompanyName property.</param>
    Public Shared Function CreateCustomer(customerID As Global.System.String, companyName As Global.System.String) As Customer
        Dim customer as Customer = New Customer
        customer.CustomerID = customerID
        customer.CompanyName = companyName
        Return customer
    End Function

    #End Region
    #Region "Primitive Properties"

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=true, IsNullable:=false)>
    <DataMemberAttribute()>
    Public Property CustomerID() As Global.System.String
        Get
            Return _CustomerID
        End Get
        Set
            If (_CustomerID <> Value) Then
                OnCustomerIDChanging(value)
                ReportPropertyChanging("CustomerID")
                _CustomerID = StructuralObject.SetValidValue(value, false)
                ReportPropertyChanged("CustomerID")
                OnCustomerIDChanged()
            End If
        End Set
    End Property

    Private _CustomerID As Global.System.String
    Private Partial Sub OnCustomerIDChanging(value As Global.System.String)
    End Sub

    Private Partial Sub OnCustomerIDChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=false)>
    <DataMemberAttribute()>
    Public Property CompanyName() As Global.System.String
        Get
            Return _CompanyName
        End Get
        Set
            OnCompanyNameChanging(value)
            ReportPropertyChanging("CompanyName")
            _CompanyName = StructuralObject.SetValidValue(value, false)
            ReportPropertyChanged("CompanyName")
            OnCompanyNameChanged()
        End Set
    End Property

    Private _CompanyName As Global.System.String
    Private Partial Sub OnCompanyNameChanging(value As Global.System.String)
    End Sub

    Private Partial Sub OnCompanyNameChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=true)>
    <DataMemberAttribute()>
    Public Property ContactName() As Global.System.String
        Get
            Return _ContactName
        End Get
        Set
            OnContactNameChanging(value)
            ReportPropertyChanging("ContactName")
            _ContactName = StructuralObject.SetValidValue(value, true)
            ReportPropertyChanged("ContactName")
            OnContactNameChanged()
        End Set
    End Property

    Private _ContactName As Global.System.String
    Private Partial Sub OnContactNameChanging(value As Global.System.String)
    End Sub

    Private Partial Sub OnContactNameChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=true)>
    <DataMemberAttribute()>
    Public Property ContactTitle() As Global.System.String
        Get
            Return _ContactTitle
        End Get
        Set
            OnContactTitleChanging(value)
            ReportPropertyChanging("ContactTitle")
            _ContactTitle = StructuralObject.SetValidValue(value, true)
            ReportPropertyChanged("ContactTitle")
            OnContactTitleChanged()
        End Set
    End Property

    Private _ContactTitle As Global.System.String
    Private Partial Sub OnContactTitleChanging(value As Global.System.String)
    End Sub

    Private Partial Sub OnContactTitleChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=true)>
    <DataMemberAttribute()>
    Public Property Address() As Global.System.String
        Get
            Return _Address
        End Get
        Set
            OnAddressChanging(value)
            ReportPropertyChanging("Address")
            _Address = StructuralObject.SetValidValue(value, true)
            ReportPropertyChanged("Address")
            OnAddressChanged()
        End Set
    End Property

    Private _Address As Global.System.String
    Private Partial Sub OnAddressChanging(value As Global.System.String)
    End Sub

    Private Partial Sub OnAddressChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=true)>
    <DataMemberAttribute()>
    Public Property City() As Global.System.String
        Get
            Return _City
        End Get
        Set
            OnCityChanging(value)
            ReportPropertyChanging("City")
            _City = StructuralObject.SetValidValue(value, true)
            ReportPropertyChanged("City")
            OnCityChanged()
        End Set
    End Property

    Private _City As Global.System.String
    Private Partial Sub OnCityChanging(value As Global.System.String)
    End Sub

    Private Partial Sub OnCityChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=true)>
    <DataMemberAttribute()>
    Public Property Region() As Global.System.String
        Get
            Return _Region
        End Get
        Set
            OnRegionChanging(value)
            ReportPropertyChanging("Region")
            _Region = StructuralObject.SetValidValue(value, true)
            ReportPropertyChanged("Region")
            OnRegionChanged()
        End Set
    End Property

    Private _Region As Global.System.String
    Private Partial Sub OnRegionChanging(value As Global.System.String)
    End Sub

    Private Partial Sub OnRegionChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=true)>
    <DataMemberAttribute()>
    Public Property PostalCode() As Global.System.String
        Get
            Return _PostalCode
        End Get
        Set
            OnPostalCodeChanging(value)
            ReportPropertyChanging("PostalCode")
            _PostalCode = StructuralObject.SetValidValue(value, true)
            ReportPropertyChanged("PostalCode")
            OnPostalCodeChanged()
        End Set
    End Property

    Private _PostalCode As Global.System.String
    Private Partial Sub OnPostalCodeChanging(value As Global.System.String)
    End Sub

    Private Partial Sub OnPostalCodeChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=true)>
    <DataMemberAttribute()>
    Public Property Country() As Global.System.String
        Get
            Return _Country
        End Get
        Set
            OnCountryChanging(value)
            ReportPropertyChanging("Country")
            _Country = StructuralObject.SetValidValue(value, true)
            ReportPropertyChanged("Country")
            OnCountryChanged()
        End Set
    End Property

    Private _Country As Global.System.String
    Private Partial Sub OnCountryChanging(value As Global.System.String)
    End Sub

    Private Partial Sub OnCountryChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=true)>
    <DataMemberAttribute()>
    Public Property Phone() As Global.System.String
        Get
            Return _Phone
        End Get
        Set
            OnPhoneChanging(value)
            ReportPropertyChanging("Phone")
            _Phone = StructuralObject.SetValidValue(value, true)
            ReportPropertyChanged("Phone")
            OnPhoneChanged()
        End Set
    End Property

    Private _Phone As Global.System.String
    Private Partial Sub OnPhoneChanging(value As Global.System.String)
    End Sub

    Private Partial Sub OnPhoneChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=true)>
    <DataMemberAttribute()>
    Public Property Fax() As Global.System.String
        Get
            Return _Fax
        End Get
        Set
            OnFaxChanging(value)
            ReportPropertyChanging("Fax")
            _Fax = StructuralObject.SetValidValue(value, true)
            ReportPropertyChanged("Fax")
            OnFaxChanged()
        End Set
    End Property

    Private _Fax As Global.System.String
    Private Partial Sub OnFaxChanging(value As Global.System.String)
    End Sub

    Private Partial Sub OnFaxChanged()
    End Sub

    #End Region
    #Region "Navigation Properties"

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <XmlIgnoreAttribute()>
    <SoapIgnoreAttribute()>
    <DataMemberAttribute()>
    <EdmRelationshipNavigationPropertyAttribute("northwndModel", "FK_Orders_Customers", "Orders")>
     Public Property Orders() As EntityCollection(Of Order)
        Get
            Return CType(Me,IEntityWithRelationships).RelationshipManager.GetRelatedCollection(Of Order)("northwndModel.FK_Orders_Customers", "Orders")
        End Get
        Set
            If (Not value Is Nothing)
                CType(Me, IEntityWithRelationships).RelationshipManager.InitializeRelatedCollection(Of Order)("northwndModel.FK_Orders_Customers", "Orders", value)
            End If
        End Set
    End Property

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <XmlIgnoreAttribute()>
    <SoapIgnoreAttribute()>
    <DataMemberAttribute()>
    <EdmRelationshipNavigationPropertyAttribute("northwndModel", "CustomerCustomerDemo", "CustomerDemographics")>
     Public Property CustomerDemographics() As EntityCollection(Of CustomerDemographic)
        Get
            Return CType(Me,IEntityWithRelationships).RelationshipManager.GetRelatedCollection(Of CustomerDemographic)("northwndModel.CustomerCustomerDemo", "CustomerDemographics")
        End Get
        Set
            If (Not value Is Nothing)
                CType(Me, IEntityWithRelationships).RelationshipManager.InitializeRelatedCollection(Of CustomerDemographic)("northwndModel.CustomerCustomerDemo", "CustomerDemographics", value)
            End If
        End Set
    End Property

    #End Region
End Class

''' <summary>
''' No Metadata Documentation available.
''' </summary>
<EdmEntityTypeAttribute(NamespaceName:="northwndModel", Name:="CustomerDemographic")>
<Serializable()>
<DataContractAttribute(IsReference:=True)>
Public Partial Class CustomerDemographic
    Inherits EntityObject
    #Region "Factory Method"

    ''' <summary>
    ''' Create a new CustomerDemographic object.
    ''' </summary>
    ''' <param name="customerTypeID">Initial value of the CustomerTypeID property.</param>
    Public Shared Function CreateCustomerDemographic(customerTypeID As Global.System.String) As CustomerDemographic
        Dim customerDemographic as CustomerDemographic = New CustomerDemographic
        customerDemographic.CustomerTypeID = customerTypeID
        Return customerDemographic
    End Function

    #End Region
    #Region "Primitive Properties"

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=true, IsNullable:=false)>
    <DataMemberAttribute()>
    Public Property CustomerTypeID() As Global.System.String
        Get
            Return _CustomerTypeID
        End Get
        Set
            If (_CustomerTypeID <> Value) Then
                OnCustomerTypeIDChanging(value)
                ReportPropertyChanging("CustomerTypeID")
                _CustomerTypeID = StructuralObject.SetValidValue(value, false)
                ReportPropertyChanged("CustomerTypeID")
                OnCustomerTypeIDChanged()
            End If
        End Set
    End Property

    Private _CustomerTypeID As Global.System.String
    Private Partial Sub OnCustomerTypeIDChanging(value As Global.System.String)
    End Sub

    Private Partial Sub OnCustomerTypeIDChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=true)>
    <DataMemberAttribute()>
    Public Property CustomerDesc() As Global.System.String
        Get
            Return _CustomerDesc
        End Get
        Set
            OnCustomerDescChanging(value)
            ReportPropertyChanging("CustomerDesc")
            _CustomerDesc = StructuralObject.SetValidValue(value, true)
            ReportPropertyChanged("CustomerDesc")
            OnCustomerDescChanged()
        End Set
    End Property

    Private _CustomerDesc As Global.System.String
    Private Partial Sub OnCustomerDescChanging(value As Global.System.String)
    End Sub

    Private Partial Sub OnCustomerDescChanged()
    End Sub

    #End Region
    #Region "Navigation Properties"

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <XmlIgnoreAttribute()>
    <SoapIgnoreAttribute()>
    <DataMemberAttribute()>
    <EdmRelationshipNavigationPropertyAttribute("northwndModel", "CustomerCustomerDemo", "Customers")>
     Public Property Customers() As EntityCollection(Of Customer)
        Get
            Return CType(Me,IEntityWithRelationships).RelationshipManager.GetRelatedCollection(Of Customer)("northwndModel.CustomerCustomerDemo", "Customers")
        End Get
        Set
            If (Not value Is Nothing)
                CType(Me, IEntityWithRelationships).RelationshipManager.InitializeRelatedCollection(Of Customer)("northwndModel.CustomerCustomerDemo", "Customers", value)
            End If
        End Set
    End Property

    #End Region
End Class

''' <summary>
''' No Metadata Documentation available.
''' </summary>
<EdmEntityTypeAttribute(NamespaceName:="northwndModel", Name:="Employee")>
<Serializable()>
<DataContractAttribute(IsReference:=True)>
Public Partial Class Employee
    Inherits EntityObject
    #Region "Factory Method"

    ''' <summary>
    ''' Create a new Employee object.
    ''' </summary>
    ''' <param name="employeeID">Initial value of the EmployeeID property.</param>
    ''' <param name="lastName">Initial value of the LastName property.</param>
    ''' <param name="firstName">Initial value of the FirstName property.</param>
    Public Shared Function CreateEmployee(employeeID As Global.System.Int32, lastName As Global.System.String, firstName As Global.System.String) As Employee
        Dim employee as Employee = New Employee
        employee.EmployeeID = employeeID
        employee.LastName = lastName
        employee.FirstName = firstName
        Return employee
    End Function

    #End Region
    #Region "Primitive Properties"

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=true, IsNullable:=false)>
    <DataMemberAttribute()>
    Public Property EmployeeID() As Global.System.Int32
        Get
            Return _EmployeeID
        End Get
        Set
            If (_EmployeeID <> Value) Then
                OnEmployeeIDChanging(value)
                ReportPropertyChanging("EmployeeID")
                _EmployeeID = StructuralObject.SetValidValue(value)
                ReportPropertyChanged("EmployeeID")
                OnEmployeeIDChanged()
            End If
        End Set
    End Property

    Private _EmployeeID As Global.System.Int32
    Private Partial Sub OnEmployeeIDChanging(value As Global.System.Int32)
    End Sub

    Private Partial Sub OnEmployeeIDChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=false)>
    <DataMemberAttribute()>
    Public Property LastName() As Global.System.String
        Get
            Return _LastName
        End Get
        Set
            OnLastNameChanging(value)
            ReportPropertyChanging("LastName")
            _LastName = StructuralObject.SetValidValue(value, false)
            ReportPropertyChanged("LastName")
            OnLastNameChanged()
        End Set
    End Property

    Private _LastName As Global.System.String
    Private Partial Sub OnLastNameChanging(value As Global.System.String)
    End Sub

    Private Partial Sub OnLastNameChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=false)>
    <DataMemberAttribute()>
    Public Property FirstName() As Global.System.String
        Get
            Return _FirstName
        End Get
        Set
            OnFirstNameChanging(value)
            ReportPropertyChanging("FirstName")
            _FirstName = StructuralObject.SetValidValue(value, false)
            ReportPropertyChanged("FirstName")
            OnFirstNameChanged()
        End Set
    End Property

    Private _FirstName As Global.System.String
    Private Partial Sub OnFirstNameChanging(value As Global.System.String)
    End Sub

    Private Partial Sub OnFirstNameChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=true)>
    <DataMemberAttribute()>
    Public Property Title() As Global.System.String
        Get
            Return _Title
        End Get
        Set
            OnTitleChanging(value)
            ReportPropertyChanging("Title")
            _Title = StructuralObject.SetValidValue(value, true)
            ReportPropertyChanged("Title")
            OnTitleChanged()
        End Set
    End Property

    Private _Title As Global.System.String
    Private Partial Sub OnTitleChanging(value As Global.System.String)
    End Sub

    Private Partial Sub OnTitleChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=true)>
    <DataMemberAttribute()>
    Public Property TitleOfCourtesy() As Global.System.String
        Get
            Return _TitleOfCourtesy
        End Get
        Set
            OnTitleOfCourtesyChanging(value)
            ReportPropertyChanging("TitleOfCourtesy")
            _TitleOfCourtesy = StructuralObject.SetValidValue(value, true)
            ReportPropertyChanged("TitleOfCourtesy")
            OnTitleOfCourtesyChanged()
        End Set
    End Property

    Private _TitleOfCourtesy As Global.System.String
    Private Partial Sub OnTitleOfCourtesyChanging(value As Global.System.String)
    End Sub

    Private Partial Sub OnTitleOfCourtesyChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=true)>
    <DataMemberAttribute()>
    Public Property BirthDate() As Nullable(Of Global.System.DateTime)
        Get
            Return _BirthDate
        End Get
        Set
            OnBirthDateChanging(value)
            ReportPropertyChanging("BirthDate")
            _BirthDate = StructuralObject.SetValidValue(value)
            ReportPropertyChanged("BirthDate")
            OnBirthDateChanged()
        End Set
    End Property

    Private _BirthDate As Nullable(Of Global.System.DateTime)
    Private Partial Sub OnBirthDateChanging(value As Nullable(Of Global.System.DateTime))
    End Sub

    Private Partial Sub OnBirthDateChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=true)>
    <DataMemberAttribute()>
    Public Property HireDate() As Nullable(Of Global.System.DateTime)
        Get
            Return _HireDate
        End Get
        Set
            OnHireDateChanging(value)
            ReportPropertyChanging("HireDate")
            _HireDate = StructuralObject.SetValidValue(value)
            ReportPropertyChanged("HireDate")
            OnHireDateChanged()
        End Set
    End Property

    Private _HireDate As Nullable(Of Global.System.DateTime)
    Private Partial Sub OnHireDateChanging(value As Nullable(Of Global.System.DateTime))
    End Sub

    Private Partial Sub OnHireDateChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=true)>
    <DataMemberAttribute()>
    Public Property Address() As Global.System.String
        Get
            Return _Address
        End Get
        Set
            OnAddressChanging(value)
            ReportPropertyChanging("Address")
            _Address = StructuralObject.SetValidValue(value, true)
            ReportPropertyChanged("Address")
            OnAddressChanged()
        End Set
    End Property

    Private _Address As Global.System.String
    Private Partial Sub OnAddressChanging(value As Global.System.String)
    End Sub

    Private Partial Sub OnAddressChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=true)>
    <DataMemberAttribute()>
    Public Property City() As Global.System.String
        Get
            Return _City
        End Get
        Set
            OnCityChanging(value)
            ReportPropertyChanging("City")
            _City = StructuralObject.SetValidValue(value, true)
            ReportPropertyChanged("City")
            OnCityChanged()
        End Set
    End Property

    Private _City As Global.System.String
    Private Partial Sub OnCityChanging(value As Global.System.String)
    End Sub

    Private Partial Sub OnCityChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=true)>
    <DataMemberAttribute()>
    Public Property Region() As Global.System.String
        Get
            Return _Region
        End Get
        Set
            OnRegionChanging(value)
            ReportPropertyChanging("Region")
            _Region = StructuralObject.SetValidValue(value, true)
            ReportPropertyChanged("Region")
            OnRegionChanged()
        End Set
    End Property

    Private _Region As Global.System.String
    Private Partial Sub OnRegionChanging(value As Global.System.String)
    End Sub

    Private Partial Sub OnRegionChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=true)>
    <DataMemberAttribute()>
    Public Property PostalCode() As Global.System.String
        Get
            Return _PostalCode
        End Get
        Set
            OnPostalCodeChanging(value)
            ReportPropertyChanging("PostalCode")
            _PostalCode = StructuralObject.SetValidValue(value, true)
            ReportPropertyChanged("PostalCode")
            OnPostalCodeChanged()
        End Set
    End Property

    Private _PostalCode As Global.System.String
    Private Partial Sub OnPostalCodeChanging(value As Global.System.String)
    End Sub

    Private Partial Sub OnPostalCodeChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=true)>
    <DataMemberAttribute()>
    Public Property Country() As Global.System.String
        Get
            Return _Country
        End Get
        Set
            OnCountryChanging(value)
            ReportPropertyChanging("Country")
            _Country = StructuralObject.SetValidValue(value, true)
            ReportPropertyChanged("Country")
            OnCountryChanged()
        End Set
    End Property

    Private _Country As Global.System.String
    Private Partial Sub OnCountryChanging(value As Global.System.String)
    End Sub

    Private Partial Sub OnCountryChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=true)>
    <DataMemberAttribute()>
    Public Property HomePhone() As Global.System.String
        Get
            Return _HomePhone
        End Get
        Set
            OnHomePhoneChanging(value)
            ReportPropertyChanging("HomePhone")
            _HomePhone = StructuralObject.SetValidValue(value, true)
            ReportPropertyChanged("HomePhone")
            OnHomePhoneChanged()
        End Set
    End Property

    Private _HomePhone As Global.System.String
    Private Partial Sub OnHomePhoneChanging(value As Global.System.String)
    End Sub

    Private Partial Sub OnHomePhoneChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=true)>
    <DataMemberAttribute()>
    Public Property Extension() As Global.System.String
        Get
            Return _Extension
        End Get
        Set
            OnExtensionChanging(value)
            ReportPropertyChanging("Extension")
            _Extension = StructuralObject.SetValidValue(value, true)
            ReportPropertyChanged("Extension")
            OnExtensionChanged()
        End Set
    End Property

    Private _Extension As Global.System.String
    Private Partial Sub OnExtensionChanging(value As Global.System.String)
    End Sub

    Private Partial Sub OnExtensionChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=true)>
    <DataMemberAttribute()>
    Public Property Photo() As Global.System.Byte()
        Get
                Return StructuralObject.GetValidValue(_Photo)
        End Get
        Set
            OnPhotoChanging(value)
            ReportPropertyChanging("Photo")
            _Photo = StructuralObject.SetValidValue(value, true)
            ReportPropertyChanged("Photo")
            OnPhotoChanged()
        End Set
    End Property

    Private _Photo As Global.System.Byte()
    Private Partial Sub OnPhotoChanging(value As Global.System.Byte())
    End Sub

    Private Partial Sub OnPhotoChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=true)>
    <DataMemberAttribute()>
    Public Property Notes() As Global.System.String
        Get
            Return _Notes
        End Get
        Set
            OnNotesChanging(value)
            ReportPropertyChanging("Notes")
            _Notes = StructuralObject.SetValidValue(value, true)
            ReportPropertyChanged("Notes")
            OnNotesChanged()
        End Set
    End Property

    Private _Notes As Global.System.String
    Private Partial Sub OnNotesChanging(value As Global.System.String)
    End Sub

    Private Partial Sub OnNotesChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=true)>
    <DataMemberAttribute()>
    Public Property ReportsTo() As Nullable(Of Global.System.Int32)
        Get
            Return _ReportsTo
        End Get
        Set
            OnReportsToChanging(value)
            ReportPropertyChanging("ReportsTo")
            _ReportsTo = StructuralObject.SetValidValue(value)
            ReportPropertyChanged("ReportsTo")
            OnReportsToChanged()
        End Set
    End Property

    Private _ReportsTo As Nullable(Of Global.System.Int32)
    Private Partial Sub OnReportsToChanging(value As Nullable(Of Global.System.Int32))
    End Sub

    Private Partial Sub OnReportsToChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=true)>
    <DataMemberAttribute()>
    Public Property PhotoPath() As Global.System.String
        Get
            Return _PhotoPath
        End Get
        Set
            OnPhotoPathChanging(value)
            ReportPropertyChanging("PhotoPath")
            _PhotoPath = StructuralObject.SetValidValue(value, true)
            ReportPropertyChanged("PhotoPath")
            OnPhotoPathChanged()
        End Set
    End Property

    Private _PhotoPath As Global.System.String
    Private Partial Sub OnPhotoPathChanging(value As Global.System.String)
    End Sub

    Private Partial Sub OnPhotoPathChanged()
    End Sub

    #End Region
    #Region "Navigation Properties"

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <XmlIgnoreAttribute()>
    <SoapIgnoreAttribute()>
    <DataMemberAttribute()>
    <EdmRelationshipNavigationPropertyAttribute("northwndModel", "FK_Employees_Employees", "Employees1")>
     Public Property Employees1() As EntityCollection(Of Employee)
        Get
            Return CType(Me,IEntityWithRelationships).RelationshipManager.GetRelatedCollection(Of Employee)("northwndModel.FK_Employees_Employees", "Employees1")
        End Get
        Set
            If (Not value Is Nothing)
                CType(Me, IEntityWithRelationships).RelationshipManager.InitializeRelatedCollection(Of Employee)("northwndModel.FK_Employees_Employees", "Employees1", value)
            End If
        End Set
    End Property

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <XmlIgnoreAttribute()>
    <SoapIgnoreAttribute()>
    <DataMemberAttribute()>
    <EdmRelationshipNavigationPropertyAttribute("northwndModel", "FK_Employees_Employees", "Employees")>
    Public Property Employee1() As Employee
        Get
            Return CType(Me, IEntityWithRelationships).RelationshipManager.GetRelatedReference(Of Employee)("northwndModel.FK_Employees_Employees", "Employees").Value
        End Get
        Set
            CType(Me, IEntityWithRelationships).RelationshipManager.GetRelatedReference(Of Employee)("northwndModel.FK_Employees_Employees", "Employees").Value = value
        End Set
    End Property
    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <BrowsableAttribute(False)>
    <DataMemberAttribute()>
    Public Property Employee1Reference() As EntityReference(Of Employee)
        Get
            Return CType(Me, IEntityWithRelationships).RelationshipManager.GetRelatedReference(Of Employee)("northwndModel.FK_Employees_Employees", "Employees")
        End Get
        Set
            If (Not value Is Nothing)
                CType(Me, IEntityWithRelationships).RelationshipManager.InitializeRelatedReference(Of Employee)("northwndModel.FK_Employees_Employees", "Employees", value)
            End If
        End Set
    End Property

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <XmlIgnoreAttribute()>
    <SoapIgnoreAttribute()>
    <DataMemberAttribute()>
    <EdmRelationshipNavigationPropertyAttribute("northwndModel", "FK_Orders_Employees", "Orders")>
     Public Property Orders() As EntityCollection(Of Order)
        Get
            Return CType(Me,IEntityWithRelationships).RelationshipManager.GetRelatedCollection(Of Order)("northwndModel.FK_Orders_Employees", "Orders")
        End Get
        Set
            If (Not value Is Nothing)
                CType(Me, IEntityWithRelationships).RelationshipManager.InitializeRelatedCollection(Of Order)("northwndModel.FK_Orders_Employees", "Orders", value)
            End If
        End Set
    End Property

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <XmlIgnoreAttribute()>
    <SoapIgnoreAttribute()>
    <DataMemberAttribute()>
    <EdmRelationshipNavigationPropertyAttribute("northwndModel", "EmployeeTerritories", "Territories")>
     Public Property Territories() As EntityCollection(Of Territory)
        Get
            Return CType(Me,IEntityWithRelationships).RelationshipManager.GetRelatedCollection(Of Territory)("northwndModel.EmployeeTerritories", "Territories")
        End Get
        Set
            If (Not value Is Nothing)
                CType(Me, IEntityWithRelationships).RelationshipManager.InitializeRelatedCollection(Of Territory)("northwndModel.EmployeeTerritories", "Territories", value)
            End If
        End Set
    End Property

    #End Region
End Class

''' <summary>
''' No Metadata Documentation available.
''' </summary>
<EdmEntityTypeAttribute(NamespaceName:="northwndModel", Name:="Order")>
<Serializable()>
<DataContractAttribute(IsReference:=True)>
Public Partial Class Order
    Inherits EntityObject
    #Region "Factory Method"

    ''' <summary>
    ''' Create a new Order object.
    ''' </summary>
    ''' <param name="orderID">Initial value of the OrderID property.</param>
    Public Shared Function CreateOrder(orderID As Global.System.Int32) As Order
        Dim order as Order = New Order
        order.OrderID = orderID
        Return order
    End Function

    #End Region
    #Region "Primitive Properties"

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=true, IsNullable:=false)>
    <DataMemberAttribute()>
    Public Property OrderID() As Global.System.Int32
        Get
            Return _OrderID
        End Get
        Set
            If (_OrderID <> Value) Then
                OnOrderIDChanging(value)
                ReportPropertyChanging("OrderID")
                _OrderID = StructuralObject.SetValidValue(value)
                ReportPropertyChanged("OrderID")
                OnOrderIDChanged()
            End If
        End Set
    End Property

    Private _OrderID As Global.System.Int32
    Private Partial Sub OnOrderIDChanging(value As Global.System.Int32)
    End Sub

    Private Partial Sub OnOrderIDChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=true)>
    <DataMemberAttribute()>
    Public Property CustomerID() As Global.System.String
        Get
            Return _CustomerID
        End Get
        Set
            OnCustomerIDChanging(value)
            ReportPropertyChanging("CustomerID")
            _CustomerID = StructuralObject.SetValidValue(value, true)
            ReportPropertyChanged("CustomerID")
            OnCustomerIDChanged()
        End Set
    End Property

    Private _CustomerID As Global.System.String
    Private Partial Sub OnCustomerIDChanging(value As Global.System.String)
    End Sub

    Private Partial Sub OnCustomerIDChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=true)>
    <DataMemberAttribute()>
    Public Property EmployeeID() As Nullable(Of Global.System.Int32)
        Get
            Return _EmployeeID
        End Get
        Set
            OnEmployeeIDChanging(value)
            ReportPropertyChanging("EmployeeID")
            _EmployeeID = StructuralObject.SetValidValue(value)
            ReportPropertyChanged("EmployeeID")
            OnEmployeeIDChanged()
        End Set
    End Property

    Private _EmployeeID As Nullable(Of Global.System.Int32)
    Private Partial Sub OnEmployeeIDChanging(value As Nullable(Of Global.System.Int32))
    End Sub

    Private Partial Sub OnEmployeeIDChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=true)>
    <DataMemberAttribute()>
    Public Property OrderDate() As Nullable(Of Global.System.DateTime)
        Get
            Return _OrderDate
        End Get
        Set
            OnOrderDateChanging(value)
            ReportPropertyChanging("OrderDate")
            _OrderDate = StructuralObject.SetValidValue(value)
            ReportPropertyChanged("OrderDate")
            OnOrderDateChanged()
        End Set
    End Property

    Private _OrderDate As Nullable(Of Global.System.DateTime)
    Private Partial Sub OnOrderDateChanging(value As Nullable(Of Global.System.DateTime))
    End Sub

    Private Partial Sub OnOrderDateChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=true)>
    <DataMemberAttribute()>
    Public Property RequiredDate() As Nullable(Of Global.System.DateTime)
        Get
            Return _RequiredDate
        End Get
        Set
            OnRequiredDateChanging(value)
            ReportPropertyChanging("RequiredDate")
            _RequiredDate = StructuralObject.SetValidValue(value)
            ReportPropertyChanged("RequiredDate")
            OnRequiredDateChanged()
        End Set
    End Property

    Private _RequiredDate As Nullable(Of Global.System.DateTime)
    Private Partial Sub OnRequiredDateChanging(value As Nullable(Of Global.System.DateTime))
    End Sub

    Private Partial Sub OnRequiredDateChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=true)>
    <DataMemberAttribute()>
    Public Property ShippedDate() As Nullable(Of Global.System.DateTime)
        Get
            Return _ShippedDate
        End Get
        Set
            OnShippedDateChanging(value)
            ReportPropertyChanging("ShippedDate")
            _ShippedDate = StructuralObject.SetValidValue(value)
            ReportPropertyChanged("ShippedDate")
            OnShippedDateChanged()
        End Set
    End Property

    Private _ShippedDate As Nullable(Of Global.System.DateTime)
    Private Partial Sub OnShippedDateChanging(value As Nullable(Of Global.System.DateTime))
    End Sub

    Private Partial Sub OnShippedDateChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=true)>
    <DataMemberAttribute()>
    Public Property ShipVia() As Nullable(Of Global.System.Int32)
        Get
            Return _ShipVia
        End Get
        Set
            OnShipViaChanging(value)
            ReportPropertyChanging("ShipVia")
            _ShipVia = StructuralObject.SetValidValue(value)
            ReportPropertyChanged("ShipVia")
            OnShipViaChanged()
        End Set
    End Property

    Private _ShipVia As Nullable(Of Global.System.Int32)
    Private Partial Sub OnShipViaChanging(value As Nullable(Of Global.System.Int32))
    End Sub

    Private Partial Sub OnShipViaChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=true)>
    <DataMemberAttribute()>
    Public Property Freight() As Nullable(Of Global.System.Decimal)
        Get
            Return _Freight
        End Get
        Set
            OnFreightChanging(value)
            ReportPropertyChanging("Freight")
            _Freight = StructuralObject.SetValidValue(value)
            ReportPropertyChanged("Freight")
            OnFreightChanged()
        End Set
    End Property

    Private _Freight As Nullable(Of Global.System.Decimal)
    Private Partial Sub OnFreightChanging(value As Nullable(Of Global.System.Decimal))
    End Sub

    Private Partial Sub OnFreightChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=true)>
    <DataMemberAttribute()>
    Public Property ShipName() As Global.System.String
        Get
            Return _ShipName
        End Get
        Set
            OnShipNameChanging(value)
            ReportPropertyChanging("ShipName")
            _ShipName = StructuralObject.SetValidValue(value, true)
            ReportPropertyChanged("ShipName")
            OnShipNameChanged()
        End Set
    End Property

    Private _ShipName As Global.System.String
    Private Partial Sub OnShipNameChanging(value As Global.System.String)
    End Sub

    Private Partial Sub OnShipNameChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=true)>
    <DataMemberAttribute()>
    Public Property ShipAddress() As Global.System.String
        Get
            Return _ShipAddress
        End Get
        Set
            OnShipAddressChanging(value)
            ReportPropertyChanging("ShipAddress")
            _ShipAddress = StructuralObject.SetValidValue(value, true)
            ReportPropertyChanged("ShipAddress")
            OnShipAddressChanged()
        End Set
    End Property

    Private _ShipAddress As Global.System.String
    Private Partial Sub OnShipAddressChanging(value As Global.System.String)
    End Sub

    Private Partial Sub OnShipAddressChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=true)>
    <DataMemberAttribute()>
    Public Property ShipCity() As Global.System.String
        Get
            Return _ShipCity
        End Get
        Set
            OnShipCityChanging(value)
            ReportPropertyChanging("ShipCity")
            _ShipCity = StructuralObject.SetValidValue(value, true)
            ReportPropertyChanged("ShipCity")
            OnShipCityChanged()
        End Set
    End Property

    Private _ShipCity As Global.System.String
    Private Partial Sub OnShipCityChanging(value As Global.System.String)
    End Sub

    Private Partial Sub OnShipCityChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=true)>
    <DataMemberAttribute()>
    Public Property ShipRegion() As Global.System.String
        Get
            Return _ShipRegion
        End Get
        Set
            OnShipRegionChanging(value)
            ReportPropertyChanging("ShipRegion")
            _ShipRegion = StructuralObject.SetValidValue(value, true)
            ReportPropertyChanged("ShipRegion")
            OnShipRegionChanged()
        End Set
    End Property

    Private _ShipRegion As Global.System.String
    Private Partial Sub OnShipRegionChanging(value As Global.System.String)
    End Sub

    Private Partial Sub OnShipRegionChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=true)>
    <DataMemberAttribute()>
    Public Property ShipPostalCode() As Global.System.String
        Get
            Return _ShipPostalCode
        End Get
        Set
            OnShipPostalCodeChanging(value)
            ReportPropertyChanging("ShipPostalCode")
            _ShipPostalCode = StructuralObject.SetValidValue(value, true)
            ReportPropertyChanged("ShipPostalCode")
            OnShipPostalCodeChanged()
        End Set
    End Property

    Private _ShipPostalCode As Global.System.String
    Private Partial Sub OnShipPostalCodeChanging(value As Global.System.String)
    End Sub

    Private Partial Sub OnShipPostalCodeChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=true)>
    <DataMemberAttribute()>
    Public Property ShipCountry() As Global.System.String
        Get
            Return _ShipCountry
        End Get
        Set
            OnShipCountryChanging(value)
            ReportPropertyChanging("ShipCountry")
            _ShipCountry = StructuralObject.SetValidValue(value, true)
            ReportPropertyChanged("ShipCountry")
            OnShipCountryChanged()
        End Set
    End Property

    Private _ShipCountry As Global.System.String
    Private Partial Sub OnShipCountryChanging(value As Global.System.String)
    End Sub

    Private Partial Sub OnShipCountryChanged()
    End Sub

    #End Region
    #Region "Navigation Properties"

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <XmlIgnoreAttribute()>
    <SoapIgnoreAttribute()>
    <DataMemberAttribute()>
    <EdmRelationshipNavigationPropertyAttribute("northwndModel", "FK_Orders_Customers", "Customers")>
    Public Property Customer() As Customer
        Get
            Return CType(Me, IEntityWithRelationships).RelationshipManager.GetRelatedReference(Of Customer)("northwndModel.FK_Orders_Customers", "Customers").Value
        End Get
        Set
            CType(Me, IEntityWithRelationships).RelationshipManager.GetRelatedReference(Of Customer)("northwndModel.FK_Orders_Customers", "Customers").Value = value
        End Set
    End Property
    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <BrowsableAttribute(False)>
    <DataMemberAttribute()>
    Public Property CustomerReference() As EntityReference(Of Customer)
        Get
            Return CType(Me, IEntityWithRelationships).RelationshipManager.GetRelatedReference(Of Customer)("northwndModel.FK_Orders_Customers", "Customers")
        End Get
        Set
            If (Not value Is Nothing)
                CType(Me, IEntityWithRelationships).RelationshipManager.InitializeRelatedReference(Of Customer)("northwndModel.FK_Orders_Customers", "Customers", value)
            End If
        End Set
    End Property

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <XmlIgnoreAttribute()>
    <SoapIgnoreAttribute()>
    <DataMemberAttribute()>
    <EdmRelationshipNavigationPropertyAttribute("northwndModel", "FK_Orders_Employees", "Employees")>
    Public Property Employee() As Employee
        Get
            Return CType(Me, IEntityWithRelationships).RelationshipManager.GetRelatedReference(Of Employee)("northwndModel.FK_Orders_Employees", "Employees").Value
        End Get
        Set
            CType(Me, IEntityWithRelationships).RelationshipManager.GetRelatedReference(Of Employee)("northwndModel.FK_Orders_Employees", "Employees").Value = value
        End Set
    End Property
    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <BrowsableAttribute(False)>
    <DataMemberAttribute()>
    Public Property EmployeeReference() As EntityReference(Of Employee)
        Get
            Return CType(Me, IEntityWithRelationships).RelationshipManager.GetRelatedReference(Of Employee)("northwndModel.FK_Orders_Employees", "Employees")
        End Get
        Set
            If (Not value Is Nothing)
                CType(Me, IEntityWithRelationships).RelationshipManager.InitializeRelatedReference(Of Employee)("northwndModel.FK_Orders_Employees", "Employees", value)
            End If
        End Set
    End Property

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <XmlIgnoreAttribute()>
    <SoapIgnoreAttribute()>
    <DataMemberAttribute()>
    <EdmRelationshipNavigationPropertyAttribute("northwndModel", "FK_Order_Details_Orders", "Order_Details")>
     Public Property Order_Details() As EntityCollection(Of Order_Detail)
        Get
            Return CType(Me,IEntityWithRelationships).RelationshipManager.GetRelatedCollection(Of Order_Detail)("northwndModel.FK_Order_Details_Orders", "Order_Details")
        End Get
        Set
            If (Not value Is Nothing)
                CType(Me, IEntityWithRelationships).RelationshipManager.InitializeRelatedCollection(Of Order_Detail)("northwndModel.FK_Order_Details_Orders", "Order_Details", value)
            End If
        End Set
    End Property

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <XmlIgnoreAttribute()>
    <SoapIgnoreAttribute()>
    <DataMemberAttribute()>
    <EdmRelationshipNavigationPropertyAttribute("northwndModel", "FK_Orders_Shippers", "Shippers")>
    Public Property Shipper() As Shipper
        Get
            Return CType(Me, IEntityWithRelationships).RelationshipManager.GetRelatedReference(Of Shipper)("northwndModel.FK_Orders_Shippers", "Shippers").Value
        End Get
        Set
            CType(Me, IEntityWithRelationships).RelationshipManager.GetRelatedReference(Of Shipper)("northwndModel.FK_Orders_Shippers", "Shippers").Value = value
        End Set
    End Property
    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <BrowsableAttribute(False)>
    <DataMemberAttribute()>
    Public Property ShipperReference() As EntityReference(Of Shipper)
        Get
            Return CType(Me, IEntityWithRelationships).RelationshipManager.GetRelatedReference(Of Shipper)("northwndModel.FK_Orders_Shippers", "Shippers")
        End Get
        Set
            If (Not value Is Nothing)
                CType(Me, IEntityWithRelationships).RelationshipManager.InitializeRelatedReference(Of Shipper)("northwndModel.FK_Orders_Shippers", "Shippers", value)
            End If
        End Set
    End Property

    #End Region
End Class

''' <summary>
''' No Metadata Documentation available.
''' </summary>
<EdmEntityTypeAttribute(NamespaceName:="northwndModel", Name:="Order_Detail")>
<Serializable()>
<DataContractAttribute(IsReference:=True)>
Public Partial Class Order_Detail
    Inherits EntityObject
    #Region "Factory Method"

    ''' <summary>
    ''' Create a new Order_Detail object.
    ''' </summary>
    ''' <param name="orderID">Initial value of the OrderID property.</param>
    ''' <param name="productID">Initial value of the ProductID property.</param>
    ''' <param name="unitPrice">Initial value of the UnitPrice property.</param>
    ''' <param name="quantity">Initial value of the Quantity property.</param>
    ''' <param name="discount">Initial value of the Discount property.</param>
    Public Shared Function CreateOrder_Detail(orderID As Global.System.Int32, productID As Global.System.Int32, unitPrice As Global.System.Decimal, quantity As Global.System.Int16, discount As Global.System.Single) As Order_Detail
        Dim order_Detail as Order_Detail = New Order_Detail
        order_Detail.OrderID = orderID
        order_Detail.ProductID = productID
        order_Detail.UnitPrice = unitPrice
        order_Detail.Quantity = quantity
        order_Detail.Discount = discount
        Return order_Detail
    End Function

    #End Region
    #Region "Primitive Properties"

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=true, IsNullable:=false)>
    <DataMemberAttribute()>
    Public Property OrderID() As Global.System.Int32
        Get
            Return _OrderID
        End Get
        Set
            If (_OrderID <> Value) Then
                OnOrderIDChanging(value)
                ReportPropertyChanging("OrderID")
                _OrderID = StructuralObject.SetValidValue(value)
                ReportPropertyChanged("OrderID")
                OnOrderIDChanged()
            End If
        End Set
    End Property

    Private _OrderID As Global.System.Int32
    Private Partial Sub OnOrderIDChanging(value As Global.System.Int32)
    End Sub

    Private Partial Sub OnOrderIDChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=true, IsNullable:=false)>
    <DataMemberAttribute()>
    Public Property ProductID() As Global.System.Int32
        Get
            Return _ProductID
        End Get
        Set
            If (_ProductID <> Value) Then
                OnProductIDChanging(value)
                ReportPropertyChanging("ProductID")
                _ProductID = StructuralObject.SetValidValue(value)
                ReportPropertyChanged("ProductID")
                OnProductIDChanged()
            End If
        End Set
    End Property

    Private _ProductID As Global.System.Int32
    Private Partial Sub OnProductIDChanging(value As Global.System.Int32)
    End Sub

    Private Partial Sub OnProductIDChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=false)>
    <DataMemberAttribute()>
    Public Property UnitPrice() As Global.System.Decimal
        Get
            Return _UnitPrice
        End Get
        Set
            OnUnitPriceChanging(value)
            ReportPropertyChanging("UnitPrice")
            _UnitPrice = StructuralObject.SetValidValue(value)
            ReportPropertyChanged("UnitPrice")
            OnUnitPriceChanged()
        End Set
    End Property

    Private _UnitPrice As Global.System.Decimal
    Private Partial Sub OnUnitPriceChanging(value As Global.System.Decimal)
    End Sub

    Private Partial Sub OnUnitPriceChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=false)>
    <DataMemberAttribute()>
    Public Property Quantity() As Global.System.Int16
        Get
            Return _Quantity
        End Get
        Set
            OnQuantityChanging(value)
            ReportPropertyChanging("Quantity")
            _Quantity = StructuralObject.SetValidValue(value)
            ReportPropertyChanged("Quantity")
            OnQuantityChanged()
        End Set
    End Property

    Private _Quantity As Global.System.Int16
    Private Partial Sub OnQuantityChanging(value As Global.System.Int16)
    End Sub

    Private Partial Sub OnQuantityChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=false)>
    <DataMemberAttribute()>
    Public Property Discount() As Global.System.Single
        Get
            Return _Discount
        End Get
        Set
            OnDiscountChanging(value)
            ReportPropertyChanging("Discount")
            _Discount = StructuralObject.SetValidValue(value)
            ReportPropertyChanged("Discount")
            OnDiscountChanged()
        End Set
    End Property

    Private _Discount As Global.System.Single
    Private Partial Sub OnDiscountChanging(value As Global.System.Single)
    End Sub

    Private Partial Sub OnDiscountChanged()
    End Sub

    #End Region
    #Region "Navigation Properties"

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <XmlIgnoreAttribute()>
    <SoapIgnoreAttribute()>
    <DataMemberAttribute()>
    <EdmRelationshipNavigationPropertyAttribute("northwndModel", "FK_Order_Details_Orders", "Orders")>
    Public Property Order() As Order
        Get
            Return CType(Me, IEntityWithRelationships).RelationshipManager.GetRelatedReference(Of Order)("northwndModel.FK_Order_Details_Orders", "Orders").Value
        End Get
        Set
            CType(Me, IEntityWithRelationships).RelationshipManager.GetRelatedReference(Of Order)("northwndModel.FK_Order_Details_Orders", "Orders").Value = value
        End Set
    End Property
    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <BrowsableAttribute(False)>
    <DataMemberAttribute()>
    Public Property OrderReference() As EntityReference(Of Order)
        Get
            Return CType(Me, IEntityWithRelationships).RelationshipManager.GetRelatedReference(Of Order)("northwndModel.FK_Order_Details_Orders", "Orders")
        End Get
        Set
            If (Not value Is Nothing)
                CType(Me, IEntityWithRelationships).RelationshipManager.InitializeRelatedReference(Of Order)("northwndModel.FK_Order_Details_Orders", "Orders", value)
            End If
        End Set
    End Property

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <XmlIgnoreAttribute()>
    <SoapIgnoreAttribute()>
    <DataMemberAttribute()>
    <EdmRelationshipNavigationPropertyAttribute("northwndModel", "FK_Order_Details_Products", "Products")>
    Public Property Product() As Product
        Get
            Return CType(Me, IEntityWithRelationships).RelationshipManager.GetRelatedReference(Of Product)("northwndModel.FK_Order_Details_Products", "Products").Value
        End Get
        Set
            CType(Me, IEntityWithRelationships).RelationshipManager.GetRelatedReference(Of Product)("northwndModel.FK_Order_Details_Products", "Products").Value = value
        End Set
    End Property
    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <BrowsableAttribute(False)>
    <DataMemberAttribute()>
    Public Property ProductReference() As EntityReference(Of Product)
        Get
            Return CType(Me, IEntityWithRelationships).RelationshipManager.GetRelatedReference(Of Product)("northwndModel.FK_Order_Details_Products", "Products")
        End Get
        Set
            If (Not value Is Nothing)
                CType(Me, IEntityWithRelationships).RelationshipManager.InitializeRelatedReference(Of Product)("northwndModel.FK_Order_Details_Products", "Products", value)
            End If
        End Set
    End Property

    #End Region
End Class

''' <summary>
''' No Metadata Documentation available.
''' </summary>
<EdmEntityTypeAttribute(NamespaceName:="northwndModel", Name:="Product")>
<Serializable()>
<DataContractAttribute(IsReference:=True)>
Public Partial Class Product
    Inherits EntityObject
    #Region "Factory Method"

    ''' <summary>
    ''' Create a new Product object.
    ''' </summary>
    ''' <param name="productID">Initial value of the ProductID property.</param>
    ''' <param name="productName">Initial value of the ProductName property.</param>
    ''' <param name="discontinued">Initial value of the Discontinued property.</param>
    Public Shared Function CreateProduct(productID As Global.System.Int32, productName As Global.System.String, discontinued As Global.System.Boolean) As Product
        Dim product as Product = New Product
        product.ProductID = productID
        product.ProductName = productName
        product.Discontinued = discontinued
        Return product
    End Function

    #End Region
    #Region "Primitive Properties"

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=true, IsNullable:=false)>
    <DataMemberAttribute()>
    Public Property ProductID() As Global.System.Int32
        Get
            Return _ProductID
        End Get
        Set
            If (_ProductID <> Value) Then
                OnProductIDChanging(value)
                ReportPropertyChanging("ProductID")
                _ProductID = StructuralObject.SetValidValue(value)
                ReportPropertyChanged("ProductID")
                OnProductIDChanged()
            End If
        End Set
    End Property

    Private _ProductID As Global.System.Int32
    Private Partial Sub OnProductIDChanging(value As Global.System.Int32)
    End Sub

    Private Partial Sub OnProductIDChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=false)>
    <DataMemberAttribute()>
    Public Property ProductName() As Global.System.String
        Get
            Return _ProductName
        End Get
        Set
            OnProductNameChanging(value)
            ReportPropertyChanging("ProductName")
            _ProductName = StructuralObject.SetValidValue(value, false)
            ReportPropertyChanged("ProductName")
            OnProductNameChanged()
        End Set
    End Property

    Private _ProductName As Global.System.String
    Private Partial Sub OnProductNameChanging(value As Global.System.String)
    End Sub

    Private Partial Sub OnProductNameChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=true)>
    <DataMemberAttribute()>
    Public Property SupplierID() As Nullable(Of Global.System.Int32)
        Get
            Return _SupplierID
        End Get
        Set
            OnSupplierIDChanging(value)
            ReportPropertyChanging("SupplierID")
            _SupplierID = StructuralObject.SetValidValue(value)
            ReportPropertyChanged("SupplierID")
            OnSupplierIDChanged()
        End Set
    End Property

    Private _SupplierID As Nullable(Of Global.System.Int32)
    Private Partial Sub OnSupplierIDChanging(value As Nullable(Of Global.System.Int32))
    End Sub

    Private Partial Sub OnSupplierIDChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=true)>
    <DataMemberAttribute()>
    Public Property CategoryID() As Nullable(Of Global.System.Int32)
        Get
            Return _CategoryID
        End Get
        Set
            OnCategoryIDChanging(value)
            ReportPropertyChanging("CategoryID")
            _CategoryID = StructuralObject.SetValidValue(value)
            ReportPropertyChanged("CategoryID")
            OnCategoryIDChanged()
        End Set
    End Property

    Private _CategoryID As Nullable(Of Global.System.Int32)
    Private Partial Sub OnCategoryIDChanging(value As Nullable(Of Global.System.Int32))
    End Sub

    Private Partial Sub OnCategoryIDChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=true)>
    <DataMemberAttribute()>
    Public Property QuantityPerUnit() As Global.System.String
        Get
            Return _QuantityPerUnit
        End Get
        Set
            OnQuantityPerUnitChanging(value)
            ReportPropertyChanging("QuantityPerUnit")
            _QuantityPerUnit = StructuralObject.SetValidValue(value, true)
            ReportPropertyChanged("QuantityPerUnit")
            OnQuantityPerUnitChanged()
        End Set
    End Property

    Private _QuantityPerUnit As Global.System.String
    Private Partial Sub OnQuantityPerUnitChanging(value As Global.System.String)
    End Sub

    Private Partial Sub OnQuantityPerUnitChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=true)>
    <DataMemberAttribute()>
    Public Property UnitPrice() As Nullable(Of Global.System.Decimal)
        Get
            Return _UnitPrice
        End Get
        Set
            OnUnitPriceChanging(value)
            ReportPropertyChanging("UnitPrice")
            _UnitPrice = StructuralObject.SetValidValue(value)
            ReportPropertyChanged("UnitPrice")
            OnUnitPriceChanged()
        End Set
    End Property

    Private _UnitPrice As Nullable(Of Global.System.Decimal)
    Private Partial Sub OnUnitPriceChanging(value As Nullable(Of Global.System.Decimal))
    End Sub

    Private Partial Sub OnUnitPriceChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=true)>
    <DataMemberAttribute()>
    Public Property UnitsInStock() As Nullable(Of Global.System.Int16)
        Get
            Return _UnitsInStock
        End Get
        Set
            OnUnitsInStockChanging(value)
            ReportPropertyChanging("UnitsInStock")
            _UnitsInStock = StructuralObject.SetValidValue(value)
            ReportPropertyChanged("UnitsInStock")
            OnUnitsInStockChanged()
        End Set
    End Property

    Private _UnitsInStock As Nullable(Of Global.System.Int16)
    Private Partial Sub OnUnitsInStockChanging(value As Nullable(Of Global.System.Int16))
    End Sub

    Private Partial Sub OnUnitsInStockChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=true)>
    <DataMemberAttribute()>
    Public Property UnitsOnOrder() As Nullable(Of Global.System.Int16)
        Get
            Return _UnitsOnOrder
        End Get
        Set
            OnUnitsOnOrderChanging(value)
            ReportPropertyChanging("UnitsOnOrder")
            _UnitsOnOrder = StructuralObject.SetValidValue(value)
            ReportPropertyChanged("UnitsOnOrder")
            OnUnitsOnOrderChanged()
        End Set
    End Property

    Private _UnitsOnOrder As Nullable(Of Global.System.Int16)
    Private Partial Sub OnUnitsOnOrderChanging(value As Nullable(Of Global.System.Int16))
    End Sub

    Private Partial Sub OnUnitsOnOrderChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=true)>
    <DataMemberAttribute()>
    Public Property ReorderLevel() As Nullable(Of Global.System.Int16)
        Get
            Return _ReorderLevel
        End Get
        Set
            OnReorderLevelChanging(value)
            ReportPropertyChanging("ReorderLevel")
            _ReorderLevel = StructuralObject.SetValidValue(value)
            ReportPropertyChanged("ReorderLevel")
            OnReorderLevelChanged()
        End Set
    End Property

    Private _ReorderLevel As Nullable(Of Global.System.Int16)
    Private Partial Sub OnReorderLevelChanging(value As Nullable(Of Global.System.Int16))
    End Sub

    Private Partial Sub OnReorderLevelChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=false)>
    <DataMemberAttribute()>
    Public Property Discontinued() As Global.System.Boolean
        Get
            Return _Discontinued
        End Get
        Set
            OnDiscontinuedChanging(value)
            ReportPropertyChanging("Discontinued")
            _Discontinued = StructuralObject.SetValidValue(value)
            ReportPropertyChanged("Discontinued")
            OnDiscontinuedChanged()
        End Set
    End Property

    Private _Discontinued As Global.System.Boolean
    Private Partial Sub OnDiscontinuedChanging(value As Global.System.Boolean)
    End Sub

    Private Partial Sub OnDiscontinuedChanged()
    End Sub

    #End Region
    #Region "Navigation Properties"

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <XmlIgnoreAttribute()>
    <SoapIgnoreAttribute()>
    <DataMemberAttribute()>
    <EdmRelationshipNavigationPropertyAttribute("northwndModel", "FK_Products_Categories", "Categories")>
    Public Property Category() As Category
        Get
            Return CType(Me, IEntityWithRelationships).RelationshipManager.GetRelatedReference(Of Category)("northwndModel.FK_Products_Categories", "Categories").Value
        End Get
        Set
            CType(Me, IEntityWithRelationships).RelationshipManager.GetRelatedReference(Of Category)("northwndModel.FK_Products_Categories", "Categories").Value = value
        End Set
    End Property
    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <BrowsableAttribute(False)>
    <DataMemberAttribute()>
    Public Property CategoryReference() As EntityReference(Of Category)
        Get
            Return CType(Me, IEntityWithRelationships).RelationshipManager.GetRelatedReference(Of Category)("northwndModel.FK_Products_Categories", "Categories")
        End Get
        Set
            If (Not value Is Nothing)
                CType(Me, IEntityWithRelationships).RelationshipManager.InitializeRelatedReference(Of Category)("northwndModel.FK_Products_Categories", "Categories", value)
            End If
        End Set
    End Property

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <XmlIgnoreAttribute()>
    <SoapIgnoreAttribute()>
    <DataMemberAttribute()>
    <EdmRelationshipNavigationPropertyAttribute("northwndModel", "FK_Order_Details_Products", "Order_Details")>
     Public Property Order_Details() As EntityCollection(Of Order_Detail)
        Get
            Return CType(Me,IEntityWithRelationships).RelationshipManager.GetRelatedCollection(Of Order_Detail)("northwndModel.FK_Order_Details_Products", "Order_Details")
        End Get
        Set
            If (Not value Is Nothing)
                CType(Me, IEntityWithRelationships).RelationshipManager.InitializeRelatedCollection(Of Order_Detail)("northwndModel.FK_Order_Details_Products", "Order_Details", value)
            End If
        End Set
    End Property

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <XmlIgnoreAttribute()>
    <SoapIgnoreAttribute()>
    <DataMemberAttribute()>
    <EdmRelationshipNavigationPropertyAttribute("northwndModel", "FK_Products_Suppliers", "Suppliers")>
    Public Property Supplier() As Supplier
        Get
            Return CType(Me, IEntityWithRelationships).RelationshipManager.GetRelatedReference(Of Supplier)("northwndModel.FK_Products_Suppliers", "Suppliers").Value
        End Get
        Set
            CType(Me, IEntityWithRelationships).RelationshipManager.GetRelatedReference(Of Supplier)("northwndModel.FK_Products_Suppliers", "Suppliers").Value = value
        End Set
    End Property
    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <BrowsableAttribute(False)>
    <DataMemberAttribute()>
    Public Property SupplierReference() As EntityReference(Of Supplier)
        Get
            Return CType(Me, IEntityWithRelationships).RelationshipManager.GetRelatedReference(Of Supplier)("northwndModel.FK_Products_Suppliers", "Suppliers")
        End Get
        Set
            If (Not value Is Nothing)
                CType(Me, IEntityWithRelationships).RelationshipManager.InitializeRelatedReference(Of Supplier)("northwndModel.FK_Products_Suppliers", "Suppliers", value)
            End If
        End Set
    End Property

    #End Region
End Class

''' <summary>
''' No Metadata Documentation available.
''' </summary>
<EdmEntityTypeAttribute(NamespaceName:="northwndModel", Name:="Region")>
<Serializable()>
<DataContractAttribute(IsReference:=True)>
Public Partial Class Region
    Inherits EntityObject
    #Region "Factory Method"

    ''' <summary>
    ''' Create a new Region object.
    ''' </summary>
    ''' <param name="regionID">Initial value of the RegionID property.</param>
    ''' <param name="regionDescription">Initial value of the RegionDescription property.</param>
    Public Shared Function CreateRegion(regionID As Global.System.Int32, regionDescription As Global.System.String) As Region
        Dim region as Region = New Region
        region.RegionID = regionID
        region.RegionDescription = regionDescription
        Return region
    End Function

    #End Region
    #Region "Primitive Properties"

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=true, IsNullable:=false)>
    <DataMemberAttribute()>
    Public Property RegionID() As Global.System.Int32
        Get
            Return _RegionID
        End Get
        Set
            If (_RegionID <> Value) Then
                OnRegionIDChanging(value)
                ReportPropertyChanging("RegionID")
                _RegionID = StructuralObject.SetValidValue(value)
                ReportPropertyChanged("RegionID")
                OnRegionIDChanged()
            End If
        End Set
    End Property

    Private _RegionID As Global.System.Int32
    Private Partial Sub OnRegionIDChanging(value As Global.System.Int32)
    End Sub

    Private Partial Sub OnRegionIDChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=false)>
    <DataMemberAttribute()>
    Public Property RegionDescription() As Global.System.String
        Get
            Return _RegionDescription
        End Get
        Set
            OnRegionDescriptionChanging(value)
            ReportPropertyChanging("RegionDescription")
            _RegionDescription = StructuralObject.SetValidValue(value, false)
            ReportPropertyChanged("RegionDescription")
            OnRegionDescriptionChanged()
        End Set
    End Property

    Private _RegionDescription As Global.System.String
    Private Partial Sub OnRegionDescriptionChanging(value As Global.System.String)
    End Sub

    Private Partial Sub OnRegionDescriptionChanged()
    End Sub

    #End Region
    #Region "Navigation Properties"

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <XmlIgnoreAttribute()>
    <SoapIgnoreAttribute()>
    <DataMemberAttribute()>
    <EdmRelationshipNavigationPropertyAttribute("northwndModel", "FK_Territories_Region", "Territories")>
     Public Property Territories() As EntityCollection(Of Territory)
        Get
            Return CType(Me,IEntityWithRelationships).RelationshipManager.GetRelatedCollection(Of Territory)("northwndModel.FK_Territories_Region", "Territories")
        End Get
        Set
            If (Not value Is Nothing)
                CType(Me, IEntityWithRelationships).RelationshipManager.InitializeRelatedCollection(Of Territory)("northwndModel.FK_Territories_Region", "Territories", value)
            End If
        End Set
    End Property

    #End Region
End Class

''' <summary>
''' No Metadata Documentation available.
''' </summary>
<EdmEntityTypeAttribute(NamespaceName:="northwndModel", Name:="Shipper")>
<Serializable()>
<DataContractAttribute(IsReference:=True)>
Public Partial Class Shipper
    Inherits EntityObject
    #Region "Factory Method"

    ''' <summary>
    ''' Create a new Shipper object.
    ''' </summary>
    ''' <param name="shipperID">Initial value of the ShipperID property.</param>
    ''' <param name="companyName">Initial value of the CompanyName property.</param>
    Public Shared Function CreateShipper(shipperID As Global.System.Int32, companyName As Global.System.String) As Shipper
        Dim shipper as Shipper = New Shipper
        shipper.ShipperID = shipperID
        shipper.CompanyName = companyName
        Return shipper
    End Function

    #End Region
    #Region "Primitive Properties"

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=true, IsNullable:=false)>
    <DataMemberAttribute()>
    Public Property ShipperID() As Global.System.Int32
        Get
            Return _ShipperID
        End Get
        Set
            If (_ShipperID <> Value) Then
                OnShipperIDChanging(value)
                ReportPropertyChanging("ShipperID")
                _ShipperID = StructuralObject.SetValidValue(value)
                ReportPropertyChanged("ShipperID")
                OnShipperIDChanged()
            End If
        End Set
    End Property

    Private _ShipperID As Global.System.Int32
    Private Partial Sub OnShipperIDChanging(value As Global.System.Int32)
    End Sub

    Private Partial Sub OnShipperIDChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=false)>
    <DataMemberAttribute()>
    Public Property CompanyName() As Global.System.String
        Get
            Return _CompanyName
        End Get
        Set
            OnCompanyNameChanging(value)
            ReportPropertyChanging("CompanyName")
            _CompanyName = StructuralObject.SetValidValue(value, false)
            ReportPropertyChanged("CompanyName")
            OnCompanyNameChanged()
        End Set
    End Property

    Private _CompanyName As Global.System.String
    Private Partial Sub OnCompanyNameChanging(value As Global.System.String)
    End Sub

    Private Partial Sub OnCompanyNameChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=true)>
    <DataMemberAttribute()>
    Public Property Phone() As Global.System.String
        Get
            Return _Phone
        End Get
        Set
            OnPhoneChanging(value)
            ReportPropertyChanging("Phone")
            _Phone = StructuralObject.SetValidValue(value, true)
            ReportPropertyChanged("Phone")
            OnPhoneChanged()
        End Set
    End Property

    Private _Phone As Global.System.String
    Private Partial Sub OnPhoneChanging(value As Global.System.String)
    End Sub

    Private Partial Sub OnPhoneChanged()
    End Sub

    #End Region
    #Region "Navigation Properties"

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <XmlIgnoreAttribute()>
    <SoapIgnoreAttribute()>
    <DataMemberAttribute()>
    <EdmRelationshipNavigationPropertyAttribute("northwndModel", "FK_Orders_Shippers", "Orders")>
     Public Property Orders() As EntityCollection(Of Order)
        Get
            Return CType(Me,IEntityWithRelationships).RelationshipManager.GetRelatedCollection(Of Order)("northwndModel.FK_Orders_Shippers", "Orders")
        End Get
        Set
            If (Not value Is Nothing)
                CType(Me, IEntityWithRelationships).RelationshipManager.InitializeRelatedCollection(Of Order)("northwndModel.FK_Orders_Shippers", "Orders", value)
            End If
        End Set
    End Property

    #End Region
End Class

''' <summary>
''' No Metadata Documentation available.
''' </summary>
<EdmEntityTypeAttribute(NamespaceName:="northwndModel", Name:="Supplier")>
<Serializable()>
<DataContractAttribute(IsReference:=True)>
Public Partial Class Supplier
    Inherits EntityObject
    #Region "Factory Method"

    ''' <summary>
    ''' Create a new Supplier object.
    ''' </summary>
    ''' <param name="supplierID">Initial value of the SupplierID property.</param>
    ''' <param name="companyName">Initial value of the CompanyName property.</param>
    Public Shared Function CreateSupplier(supplierID As Global.System.Int32, companyName As Global.System.String) As Supplier
        Dim supplier as Supplier = New Supplier
        supplier.SupplierID = supplierID
        supplier.CompanyName = companyName
        Return supplier
    End Function

    #End Region
    #Region "Primitive Properties"

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=true, IsNullable:=false)>
    <DataMemberAttribute()>
    Public Property SupplierID() As Global.System.Int32
        Get
            Return _SupplierID
        End Get
        Set
            If (_SupplierID <> Value) Then
                OnSupplierIDChanging(value)
                ReportPropertyChanging("SupplierID")
                _SupplierID = StructuralObject.SetValidValue(value)
                ReportPropertyChanged("SupplierID")
                OnSupplierIDChanged()
            End If
        End Set
    End Property

    Private _SupplierID As Global.System.Int32
    Private Partial Sub OnSupplierIDChanging(value As Global.System.Int32)
    End Sub

    Private Partial Sub OnSupplierIDChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=false)>
    <DataMemberAttribute()>
    Public Property CompanyName() As Global.System.String
        Get
            Return _CompanyName
        End Get
        Set
            OnCompanyNameChanging(value)
            ReportPropertyChanging("CompanyName")
            _CompanyName = StructuralObject.SetValidValue(value, false)
            ReportPropertyChanged("CompanyName")
            OnCompanyNameChanged()
        End Set
    End Property

    Private _CompanyName As Global.System.String
    Private Partial Sub OnCompanyNameChanging(value As Global.System.String)
    End Sub

    Private Partial Sub OnCompanyNameChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=true)>
    <DataMemberAttribute()>
    Public Property ContactName() As Global.System.String
        Get
            Return _ContactName
        End Get
        Set
            OnContactNameChanging(value)
            ReportPropertyChanging("ContactName")
            _ContactName = StructuralObject.SetValidValue(value, true)
            ReportPropertyChanged("ContactName")
            OnContactNameChanged()
        End Set
    End Property

    Private _ContactName As Global.System.String
    Private Partial Sub OnContactNameChanging(value As Global.System.String)
    End Sub

    Private Partial Sub OnContactNameChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=true)>
    <DataMemberAttribute()>
    Public Property ContactTitle() As Global.System.String
        Get
            Return _ContactTitle
        End Get
        Set
            OnContactTitleChanging(value)
            ReportPropertyChanging("ContactTitle")
            _ContactTitle = StructuralObject.SetValidValue(value, true)
            ReportPropertyChanged("ContactTitle")
            OnContactTitleChanged()
        End Set
    End Property

    Private _ContactTitle As Global.System.String
    Private Partial Sub OnContactTitleChanging(value As Global.System.String)
    End Sub

    Private Partial Sub OnContactTitleChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=true)>
    <DataMemberAttribute()>
    Public Property Address() As Global.System.String
        Get
            Return _Address
        End Get
        Set
            OnAddressChanging(value)
            ReportPropertyChanging("Address")
            _Address = StructuralObject.SetValidValue(value, true)
            ReportPropertyChanged("Address")
            OnAddressChanged()
        End Set
    End Property

    Private _Address As Global.System.String
    Private Partial Sub OnAddressChanging(value As Global.System.String)
    End Sub

    Private Partial Sub OnAddressChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=true)>
    <DataMemberAttribute()>
    Public Property City() As Global.System.String
        Get
            Return _City
        End Get
        Set
            OnCityChanging(value)
            ReportPropertyChanging("City")
            _City = StructuralObject.SetValidValue(value, true)
            ReportPropertyChanged("City")
            OnCityChanged()
        End Set
    End Property

    Private _City As Global.System.String
    Private Partial Sub OnCityChanging(value As Global.System.String)
    End Sub

    Private Partial Sub OnCityChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=true)>
    <DataMemberAttribute()>
    Public Property Region() As Global.System.String
        Get
            Return _Region
        End Get
        Set
            OnRegionChanging(value)
            ReportPropertyChanging("Region")
            _Region = StructuralObject.SetValidValue(value, true)
            ReportPropertyChanged("Region")
            OnRegionChanged()
        End Set
    End Property

    Private _Region As Global.System.String
    Private Partial Sub OnRegionChanging(value As Global.System.String)
    End Sub

    Private Partial Sub OnRegionChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=true)>
    <DataMemberAttribute()>
    Public Property PostalCode() As Global.System.String
        Get
            Return _PostalCode
        End Get
        Set
            OnPostalCodeChanging(value)
            ReportPropertyChanging("PostalCode")
            _PostalCode = StructuralObject.SetValidValue(value, true)
            ReportPropertyChanged("PostalCode")
            OnPostalCodeChanged()
        End Set
    End Property

    Private _PostalCode As Global.System.String
    Private Partial Sub OnPostalCodeChanging(value As Global.System.String)
    End Sub

    Private Partial Sub OnPostalCodeChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=true)>
    <DataMemberAttribute()>
    Public Property Country() As Global.System.String
        Get
            Return _Country
        End Get
        Set
            OnCountryChanging(value)
            ReportPropertyChanging("Country")
            _Country = StructuralObject.SetValidValue(value, true)
            ReportPropertyChanged("Country")
            OnCountryChanged()
        End Set
    End Property

    Private _Country As Global.System.String
    Private Partial Sub OnCountryChanging(value As Global.System.String)
    End Sub

    Private Partial Sub OnCountryChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=true)>
    <DataMemberAttribute()>
    Public Property Phone() As Global.System.String
        Get
            Return _Phone
        End Get
        Set
            OnPhoneChanging(value)
            ReportPropertyChanging("Phone")
            _Phone = StructuralObject.SetValidValue(value, true)
            ReportPropertyChanged("Phone")
            OnPhoneChanged()
        End Set
    End Property

    Private _Phone As Global.System.String
    Private Partial Sub OnPhoneChanging(value As Global.System.String)
    End Sub

    Private Partial Sub OnPhoneChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=true)>
    <DataMemberAttribute()>
    Public Property Fax() As Global.System.String
        Get
            Return _Fax
        End Get
        Set
            OnFaxChanging(value)
            ReportPropertyChanging("Fax")
            _Fax = StructuralObject.SetValidValue(value, true)
            ReportPropertyChanged("Fax")
            OnFaxChanged()
        End Set
    End Property

    Private _Fax As Global.System.String
    Private Partial Sub OnFaxChanging(value As Global.System.String)
    End Sub

    Private Partial Sub OnFaxChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=true)>
    <DataMemberAttribute()>
    Public Property HomePage() As Global.System.String
        Get
            Return _HomePage
        End Get
        Set
            OnHomePageChanging(value)
            ReportPropertyChanging("HomePage")
            _HomePage = StructuralObject.SetValidValue(value, true)
            ReportPropertyChanged("HomePage")
            OnHomePageChanged()
        End Set
    End Property

    Private _HomePage As Global.System.String
    Private Partial Sub OnHomePageChanging(value As Global.System.String)
    End Sub

    Private Partial Sub OnHomePageChanged()
    End Sub

    #End Region
    #Region "Navigation Properties"

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <XmlIgnoreAttribute()>
    <SoapIgnoreAttribute()>
    <DataMemberAttribute()>
    <EdmRelationshipNavigationPropertyAttribute("northwndModel", "FK_Products_Suppliers", "Products")>
     Public Property Products() As EntityCollection(Of Product)
        Get
            Return CType(Me,IEntityWithRelationships).RelationshipManager.GetRelatedCollection(Of Product)("northwndModel.FK_Products_Suppliers", "Products")
        End Get
        Set
            If (Not value Is Nothing)
                CType(Me, IEntityWithRelationships).RelationshipManager.InitializeRelatedCollection(Of Product)("northwndModel.FK_Products_Suppliers", "Products", value)
            End If
        End Set
    End Property

    #End Region
End Class

''' <summary>
''' No Metadata Documentation available.
''' </summary>
<EdmEntityTypeAttribute(NamespaceName:="northwndModel", Name:="Territory")>
<Serializable()>
<DataContractAttribute(IsReference:=True)>
Public Partial Class Territory
    Inherits EntityObject
    #Region "Factory Method"

    ''' <summary>
    ''' Create a new Territory object.
    ''' </summary>
    ''' <param name="territoryID">Initial value of the TerritoryID property.</param>
    ''' <param name="territoryDescription">Initial value of the TerritoryDescription property.</param>
    ''' <param name="regionID">Initial value of the RegionID property.</param>
    Public Shared Function CreateTerritory(territoryID As Global.System.String, territoryDescription As Global.System.String, regionID As Global.System.Int32) As Territory
        Dim territory as Territory = New Territory
        territory.TerritoryID = territoryID
        territory.TerritoryDescription = territoryDescription
        territory.RegionID = regionID
        Return territory
    End Function

    #End Region
    #Region "Primitive Properties"

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=true, IsNullable:=false)>
    <DataMemberAttribute()>
    Public Property TerritoryID() As Global.System.String
        Get
            Return _TerritoryID
        End Get
        Set
            If (_TerritoryID <> Value) Then
                OnTerritoryIDChanging(value)
                ReportPropertyChanging("TerritoryID")
                _TerritoryID = StructuralObject.SetValidValue(value, false)
                ReportPropertyChanged("TerritoryID")
                OnTerritoryIDChanged()
            End If
        End Set
    End Property

    Private _TerritoryID As Global.System.String
    Private Partial Sub OnTerritoryIDChanging(value As Global.System.String)
    End Sub

    Private Partial Sub OnTerritoryIDChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=false)>
    <DataMemberAttribute()>
    Public Property TerritoryDescription() As Global.System.String
        Get
            Return _TerritoryDescription
        End Get
        Set
            OnTerritoryDescriptionChanging(value)
            ReportPropertyChanging("TerritoryDescription")
            _TerritoryDescription = StructuralObject.SetValidValue(value, false)
            ReportPropertyChanged("TerritoryDescription")
            OnTerritoryDescriptionChanged()
        End Set
    End Property

    Private _TerritoryDescription As Global.System.String
    Private Partial Sub OnTerritoryDescriptionChanging(value As Global.System.String)
    End Sub

    Private Partial Sub OnTerritoryDescriptionChanged()
    End Sub

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=false)>
    <DataMemberAttribute()>
    Public Property RegionID() As Global.System.Int32
        Get
            Return _RegionID
        End Get
        Set
            OnRegionIDChanging(value)
            ReportPropertyChanging("RegionID")
            _RegionID = StructuralObject.SetValidValue(value)
            ReportPropertyChanged("RegionID")
            OnRegionIDChanged()
        End Set
    End Property

    Private _RegionID As Global.System.Int32
    Private Partial Sub OnRegionIDChanging(value As Global.System.Int32)
    End Sub

    Private Partial Sub OnRegionIDChanged()
    End Sub

    #End Region
    #Region "Navigation Properties"

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <XmlIgnoreAttribute()>
    <SoapIgnoreAttribute()>
    <DataMemberAttribute()>
    <EdmRelationshipNavigationPropertyAttribute("northwndModel", "FK_Territories_Region", "Region")>
    Public Property Region() As Region
        Get
            Return CType(Me, IEntityWithRelationships).RelationshipManager.GetRelatedReference(Of Region)("northwndModel.FK_Territories_Region", "Region").Value
        End Get
        Set
            CType(Me, IEntityWithRelationships).RelationshipManager.GetRelatedReference(Of Region)("northwndModel.FK_Territories_Region", "Region").Value = value
        End Set
    End Property
    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <BrowsableAttribute(False)>
    <DataMemberAttribute()>
    Public Property RegionReference() As EntityReference(Of Region)
        Get
            Return CType(Me, IEntityWithRelationships).RelationshipManager.GetRelatedReference(Of Region)("northwndModel.FK_Territories_Region", "Region")
        End Get
        Set
            If (Not value Is Nothing)
                CType(Me, IEntityWithRelationships).RelationshipManager.InitializeRelatedReference(Of Region)("northwndModel.FK_Territories_Region", "Region", value)
            End If
        End Set
    End Property

    ''' <summary>
    ''' No Metadata Documentation available.
    ''' </summary>
    <XmlIgnoreAttribute()>
    <SoapIgnoreAttribute()>
    <DataMemberAttribute()>
    <EdmRelationshipNavigationPropertyAttribute("northwndModel", "EmployeeTerritories", "Employees")>
     Public Property Employees() As EntityCollection(Of Employee)
        Get
            Return CType(Me,IEntityWithRelationships).RelationshipManager.GetRelatedCollection(Of Employee)("northwndModel.EmployeeTerritories", "Employees")
        End Get
        Set
            If (Not value Is Nothing)
                CType(Me, IEntityWithRelationships).RelationshipManager.InitializeRelatedCollection(Of Employee)("northwndModel.EmployeeTerritories", "Employees", value)
            End If
        End Set
    End Property

    #End Region
End Class

#End Region

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)


Written By
Software Developer
Brazil Brazil
Software Architect/Developer with several years experience creating and delivering software.

Full-stack Web development (including React, Firebase, TypeScript, HTML, CSS), Entity Framework, C#, MS SQL Server.

Passionate about new technologies and always keen to learn new things as well as improve on existing skills.

Comments and Discussions