Developing an Object Oriented Business Component Using WCF and Visual Studio 2008 - Understanding the WCF Business Component: Source Code for Entity classes
(Page 3 of 5 )
As explained in the previous section, we have two entity related classes, “Product” and “Products.”
The following is the source code for the “Product” class:
<DataContract()> _
Public Class Product
Private _ProductID As Integer
Private _ProductName As String
Private _UnitPrice As Double
Private _UnitsInStock As Integer
Private _UnitsOnOrder As Integer
<DataMember()> _
Public Property ProductID() As Integer
Get
Return _ProductID
End Get
Set(ByVal value As Integer)
_ProductID = value
End Set
End Property
<DataMember()> _
Public Property ProductName() As String
Get
Return _ProductName
End Get
Set(ByVal value As String)
_ProductName = value
End Set
End Property
<DataMember()> _
Public Property UnitPrice() As Double
Get
Return _UnitPrice
End Get
Set(ByVal value As Double)
_UnitPrice = value
End Set
End Property
<DataMember()> _
Public Property UnitsInStock() As Integer
Get
Return _UnitsInStock
End Get
Set(ByVal value As Integer)
_UnitsInStock = value
End Set
End Property
<DataMember()> _
Public Property UnitsOnOrder() As Integer
Get
Return _UnitsOnOrder
End Get
Set(ByVal value As Integer)
_UnitsOnOrder = value
End Set
End Property
End Class
The following is the source code for the “Products” class:
Public Class Products
Inherits List(Of Product)
End Class
The “Products” class is very simple (as shown above) as the entire code to handle a collection is defined in the “generic” class “List” in “System.Collections.Generics.”
Next: Understanding the WCF Business Component: Source Code for Business Logic >>
More BrainDump Articles
More By Jagadish Chaterjee