<<назад Instructor.vb (Contoso University).
1: #Const Type = "AfterInheritance"
2: '#Const Type = "BeforeInheritance"
3:
4: #If Type = "BeforeInheritance" Then
5: #Region "snippet_BeforeInheritance"
6:
7: Imports System
8: Imports System.Collections.Generic
9: Imports System.ComponentModel.DataAnnotations
10: Imports System.ComponentModel.DataAnnotations.Schema
11:
12: Namespace Models
13: Public Class Instructor
14:
15: Public Property ID As Integer
16:
17: <Required>
18: <Display(Name:="Last Name")>
19: <StringLength(50)>
20: Public Property LastName As String
21:
22: <Required>
23: <Column("FirstName")>
24: <Display(Name:="First Name")>
25: <StringLength(50)>
26: Public Property FirstMidName As String
27:
28: <DataType(DataType.Date)>
29: <DisplayFormat(DataFormatString:="{0:yyyy-MM-dd}", ApplyFormatInEditMode:=True)>
30: <Display(Name:="Hire Date")>
31: Public Property HireDate As DateTime
32:
33: <Display(Name:="Full Name")>
34: Public ReadOnly Property FullName As String
35: Get
36: Return LastName & ", " & FirstMidName
37: End Get
38: End Property
39:
40: Public Property CourseAssignments As ICollection(Of CourseAssignment)
41:
42: Public Property OfficeAssignment As OfficeAssignment
43: End Class
44:
45: End Namespace
46:
47: #End Region
48: #ElseIf Type = "AfterInheritance" Then
49:
50: #Region "snippet_AfterInheritance"
51: Imports System
52: Imports System.Collections.Generic
53: Imports System.ComponentModel.DataAnnotations
54: Imports System.ComponentModel.DataAnnotations.Schema
55:
56: Namespace Models
57:
58: Public Class Instructor
59: Inherits Person
60:
61: <DataType(DataType.Date)>
62: <DisplayFormat(DataFormatString:="{0:yyyy-MM-dd}", ApplyFormatInEditMode:=True)>
63: <Display(Name:="Hire Date")>
64: Public Property HireDate As DateTime
65:
66: Public Property CourseAssignments As ICollection(Of CourseAssignment)
67:
68: Public Property OfficeAssignment As ICollection(Of OfficeAssignment)
69: End Class
70: End Namespace
71: #End Region
72:
73: #End If
Comments (
)
Link to this page:
//www.vb-net.com/EF-missing-FAQ/Code/Instructor.vb.htm
|