

Imports System.Collections.Generic


' Generated by Telerik OpenAccess
<Telerik.OpenAccess.Persistent(Identity:=GetType(OrderDetail.ID))> _
Partial Public Class OrderDetail

    Private Dim _orderID As Integer 'pk

    Private Dim _productID As Integer 'pk

    Private Dim _discount As Single

    Private Dim _quantity As Short

    Private Dim _unitPrice As Decimal

    Private Dim _order As Order 'inverse Order._orderDetail

    Private Dim _product As Product


    
    ' Application identity objectid-class.
    Public Class ID 
        Implements Telerik.OpenAccess.IObjectId

        Public Dim _orderID As Integer


        Public Dim _productID As Integer


        Public Sub New()
        End Sub

        Public Sub New(s As String)
            Dim i As Integer
            Dim p As Integer
            p = 0
                        i = s.IndexOf("-"c, p)
                _orderID = System.Int32.Parse(s.Substring(p, i-p))
                p = i + 1
                i = s.IndexOf("-"c, p)
                _productID = System.Int32.Parse(s.Substring(p))

        End Sub

        Overrides Overloads Public Function Equals(ByVal o As Object) As Boolean
            If Me Is o Then
                Return True
            End If
            If Not TypeOf o Is OrderDetail.ID Then
                Return False
            End If

            Dim id As OrderDetail.ID = CType( o, OrderDetail.ID)

            If Me._orderID <> id._orderID Then 
                Return False
            End If

            If Me._productID <> id._productID Then 
                Return False
            End If

            Return True
        End Function

        Overrides Public Function GetHashCode() As Integer
            Dim result As Integer = 0
                            result = 29 * result + _orderID.GetHashCode()
                result = 29 * result + _productID.GetHashCode()

            Return result
        End Function

        Overrides Public Function ToString() As String
            Dim buffer As System.Text.StringBuilder = New System.Text.StringBuilder()

            buffer.Append(_orderID).Append("-")

            buffer.Append(_productID)

            Return buffer.ToString()
        End Function
    End Class

End Class

