forked from dotnet/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodule1.vb
45 lines (38 loc) · 1.27 KB
/
module1.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
Imports System.Data.Objects.DataClasses
Module Module1
Sub Main()
A()
B()
End Sub
'<snippet2>
<EdmFunction("SchoolModel", "YearsSince")>
Public Function YearsSince(ByVal date1 As DateTime) _
As Integer
Throw New NotSupportedException("Direct calls are not supported.")
End Function
'</snippet2>
Public Function A()
'<snippet3>
Using context As New SchoolEntities()
' Retrieve instructors hired more than 10 years ago.
Dim instructors = From p In context.People _
Where YearsSince(CType(p.HireDate, DateTime?)) > 10 _
Select p
For Each instructor In instructors
Console.WriteLine(instructor.LastName)
Next
End Using
'</snippet3>
End Function
Public Function B()
Using context As New SchoolEntities()
' Retrieve instructors hired more than 10 years ago.
Dim instructors = From p In context.People _
Where YearsSince(CType(p.HireDate, DateTime?)) > 10 _
Select p
For Each instructor In instructors
Console.WriteLine(instructor.LastName)
Next
End Using
End Function
End Module