-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMainViewModel.vb
More file actions
40 lines (38 loc) · 1.49 KB
/
MainViewModel.vb
File metadata and controls
40 lines (38 loc) · 1.49 KB
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
Imports DevExpress.Mvvm
Imports EFCoreIssues.Issues
Imports DevExpress.Mvvm.DataAnnotations
Imports DevExpress.Data.Linq
Imports Microsoft.EntityFrameworkCore
Imports System.Linq
Imports System.Collections
Public Class MainViewModel
Inherits ViewModelBase
Private _ItemsSource As EntityInstantFeedbackSource
Public ReadOnly Property ItemsSource As EntityInstantFeedbackSource
Get
If _ItemsSource Is Nothing Then
_ItemsSource = New EntityInstantFeedbackSource With {
.KeyExpression = NameOf(Issue.Id)
}
AddHandler _ItemsSource.GetQueryable, Sub(sender, e)
Dim context = New IssuesContext()
e.QueryableSource = context.Issues.AsNoTracking()
End Sub
End If
Return _ItemsSource
End Get
End Property
Private _Users As IList
Public ReadOnly Property Users As IList
Get
If _Users Is Nothing AndAlso Not DevExpress.Mvvm.ViewModelBase.IsInDesignMode Then
Dim context = New IssuesContext()
_Users = context.Users.[Select](Function(user) New With {
.Id = user.Id,
.Name = user.FirstName & " " + user.LastName
}).ToArray()
End If
Return _Users
End Get
End Property
End Class