<<назад Department.vb (Contoso University).
1: '#Const Type = "Begin"
2: #Const Type = "Final"
3:
4: #If Type = "Begin" Then
5:
6: #Region "snippet_Begin"
7:
8: Imports System
9: Imports System.Collections.Generic
10: Imports System.ComponentModel.DataAnnotations
11: Imports System.ComponentModel.DataAnnotations.Schema
12:
13: Namespace Models
14:
15: Public Class Department
16:
17: Public Property DepartmentID As Integer
18:
19: <StringLength(50, MinimumLength:=3)>
20: Public Property Name As String
21:
22: <DataType(DataType.Currency)>
23: <Column(TypeName:="money")>
24: Public Property Budget As Decimal
25:
26: <DataType(DataType.Date)>
27: <DisplayFormat(DataFormatString:="{0:yyyy-MM-dd}", ApplyFormatInEditMode:=True)>
28: <Display(Name:="Start Date")>
29: Public Property StartDate As DateTime
30:
31: Public Property InstructorID As Integer?
32:
33: Public Property Administrator As Instructor
34:
35: Public Property Courses As ICollection(Of Course)
36: End Class
37: End Namespace
38:
39: #End Region
40:
41: #ElseIf Type = "Final" Then
42:
43: #Region "snippet_Final"
44: Imports System
45: Imports System.Collections.Generic
46: Imports System.ComponentModel.DataAnnotations
47: Imports System.ComponentModel.DataAnnotations.Schema
48:
49: Namespace Models
50:
51: Public Class Department
52:
53: Public Property DepartmentID As Integer
54:
55: <StringLength(50, MinimumLength:=3)>
56: Public Property Name As String
57:
58: <DataType(DataType.Currency)>
59: <Column(TypeName:="money")>
60: Public Property Budget As Decimal
61:
62: <DataType(DataType.Date)>
63: <DisplayFormat(DataFormatString:="{0:yyyy-MM-dd}", ApplyFormatInEditMode:=True)>
64: <Display(Name:="Start Date")>
65: Public Property StartDate As DateTime
66:
67: Public Property InstructorID As Integer?
68:
69: <Timestamp>
70: Public Property RowVersion As Byte()
71:
72: Public Property Administrator As Instructor
73:
74: Public Property Courses As ICollection(Of Course)
75: End Class
76: End Namespace
77: #End Region
78:
79: #End If
Comments (
)
Link to this page:
//www.vb-net.com/EF-missing-FAQ/Code/Department.vb.htm
|