diff --git a/VB/GridControlCRUD.sln b/VB/GridControlCRUD.sln
new file mode 100644
index 0000000..c4b27bf
--- /dev/null
+++ b/VB/GridControlCRUD.sln
@@ -0,0 +1,36 @@
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.29806.167
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "GridControlCRUDSimple", "GridControlCRUDSimple\GridControlCRUDSimple.vbproj", "{9E2883B9-744A-48BF-B25A-EA4B2D435C9D}"
+EndProject
+Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "GridControlCRUDMVVM", "GridControlCRUDMVVM\GridControlCRUDMVVM.vbproj", "{69E85A61-E7D4-4C9D-A433-13E742AE30BC}"
+EndProject
+Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "GridControlCRUDMVVMAsync", "GridControlCRUDMVVMAsync\GridControlCRUDMVVMAsync.vbproj", "{659194A7-745D-4A56-A683-B150B9170F53}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {9E2883B9-744A-48BF-B25A-EA4B2D435C9D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {9E2883B9-744A-48BF-B25A-EA4B2D435C9D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {9E2883B9-744A-48BF-B25A-EA4B2D435C9D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {9E2883B9-744A-48BF-B25A-EA4B2D435C9D}.Release|Any CPU.Build.0 = Release|Any CPU
+ {69E85A61-E7D4-4C9D-A433-13E742AE30BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {69E85A61-E7D4-4C9D-A433-13E742AE30BC}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {69E85A61-E7D4-4C9D-A433-13E742AE30BC}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {69E85A61-E7D4-4C9D-A433-13E742AE30BC}.Release|Any CPU.Build.0 = Release|Any CPU
+ {659194A7-745D-4A56-A683-B150B9170F53}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {659194A7-745D-4A56-A683-B150B9170F53}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {659194A7-745D-4A56-A683-B150B9170F53}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {659194A7-745D-4A56-A683-B150B9170F53}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {51597E69-ADA1-4945-9493-FC7C9FB65AD2}
+ EndGlobalSection
+EndGlobal
diff --git a/VB/GridControlCRUDMVVM/App.config b/VB/GridControlCRUDMVVM/App.config
new file mode 100644
index 0000000..18a536d
--- /dev/null
+++ b/VB/GridControlCRUDMVVM/App.config
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/VB/GridControlCRUDMVVM/Application.xaml b/VB/GridControlCRUDMVVM/Application.xaml
new file mode 100644
index 0000000..6e24603
--- /dev/null
+++ b/VB/GridControlCRUDMVVM/Application.xaml
@@ -0,0 +1,9 @@
+
+
+
+
+
diff --git a/VB/GridControlCRUDMVVM/Application.xaml.vb b/VB/GridControlCRUDMVVM/Application.xaml.vb
new file mode 100644
index 0000000..5af5832
--- /dev/null
+++ b/VB/GridControlCRUDMVVM/Application.xaml.vb
@@ -0,0 +1,14 @@
+Imports DevExpress.Mvvm
+Imports DevExpress.Xpf.Core
+Imports System.Windows
+
+Namespace GridControlCRUDMVVM
+ Partial Public Class App
+ Inherits Application
+
+ Public Sub New()
+ ApplicationThemeHelper.UpdateApplicationThemeName()
+ DevExpress.Internal.DbEngineDetector.PatchConnectionStringsAndConfigureEntityFrameworkDefaultConnectionFactory()
+ End Sub
+ End Class
+End Namespace
diff --git a/VB/GridControlCRUDMVVM/Common.View/GridControlCRUDBehavior.vb b/VB/GridControlCRUDMVVM/Common.View/GridControlCRUDBehavior.vb
new file mode 100644
index 0000000..0e649b1
--- /dev/null
+++ b/VB/GridControlCRUDMVVM/Common.View/GridControlCRUDBehavior.vb
@@ -0,0 +1,154 @@
+Imports DevExpress.Mvvm
+Imports DevExpress.Mvvm.UI.Interactivity
+Imports DevExpress.Xpf.Core
+Imports DevExpress.Xpf.Grid
+Imports System
+Imports System.Windows
+Imports System.Windows.Input
+
+Namespace DevExpress.CRUD.View
+ Public Class GridControlCRUDBehavior
+ Inherits Behavior(Of TableView)
+
+ Public Property OnCreateCommand() As ICommand
+ Get
+ Return DirectCast(GetValue(OnCreateCommandProperty), ICommand)
+ End Get
+ Set(ByVal value As ICommand)
+ SetValue(OnCreateCommandProperty, value)
+ End Set
+ End Property
+ Public Shared ReadOnly OnCreateCommandProperty As DependencyProperty = DependencyProperty.Register("OnCreateCommand", GetType(ICommand), GetType(GridControlCRUDBehavior), New PropertyMetadata(Nothing))
+
+ Public Property OnUpdateCommand() As ICommand
+ Get
+ Return DirectCast(GetValue(OnUpdateCommandProperty), ICommand)
+ End Get
+ Set(ByVal value As ICommand)
+ SetValue(OnUpdateCommandProperty, value)
+ End Set
+ End Property
+ Public Shared ReadOnly OnUpdateCommandProperty As DependencyProperty = DependencyProperty.Register("OnUpdateCommand", GetType(ICommand), GetType(GridControlCRUDBehavior), New PropertyMetadata(Nothing))
+
+ Public Property OnDeleteCommand() As ICommand
+ Get
+ Return DirectCast(GetValue(OnDeleteCommandProperty), ICommand)
+ End Get
+ Set(ByVal value As ICommand)
+ SetValue(OnDeleteCommandProperty, value)
+ End Set
+ End Property
+ Public Shared ReadOnly OnDeleteCommandProperty As DependencyProperty = DependencyProperty.Register("OnDeleteCommand", GetType(ICommand), GetType(GridControlCRUDBehavior), New PropertyMetadata(Nothing))
+
+ Public Property OnRefreshCommand() As ICommand
+ Get
+ Return DirectCast(GetValue(OnRefreshCommandProperty), ICommand)
+ End Get
+ Set(ByVal value As ICommand)
+ SetValue(OnRefreshCommandProperty, value)
+ End Set
+ End Property
+ Public Shared ReadOnly OnRefreshCommandProperty As DependencyProperty = DependencyProperty.Register("OnRefreshCommand", GetType(ICommand), GetType(GridControlCRUDBehavior), New PropertyMetadata(Nothing))
+
+ Public Property NoRecordsErrorMessage() As String
+ Get
+ Return CStr(GetValue(NoRecordsErrorMessageProperty))
+ End Get
+ Set(ByVal value As String)
+ SetValue(NoRecordsErrorMessageProperty, value)
+ End Set
+ End Property
+ Public Shared ReadOnly NoRecordsErrorMessageProperty As DependencyProperty = DependencyProperty.Register("NoRecordsErrorMessage", GetType(String), GetType(GridControlCRUDBehavior), New PropertyMetadata(Nothing, Sub(d, e) (CType(d, GridControlCRUDBehavior)).UpdateErrorText()))
+
+ Public ReadOnly Property DeleteCommand() As ICommand
+ Public ReadOnly Property RefreshCommand() As ICommand
+
+ Private ReadOnly Property View() As TableView
+ Get
+ Return AssociatedObject
+ End Get
+ End Property
+
+ Public Sub New()
+ DeleteCommand = New DelegateCommand(AddressOf DoDelete, AddressOf CanDelete)
+ RefreshCommand = New DelegateCommand(AddressOf DoRefresh, AddressOf CanRefresh)
+ End Sub
+
+ Protected Overrides Sub OnAttached()
+ MyBase.OnAttached()
+ AddHandler View.ValidateRow, AddressOf OnValidateRow
+ AddHandler View.PreviewKeyDown, AddressOf OnPreviewKeyDown
+ UpdateErrorText()
+ End Sub
+
+ Protected Overrides Sub OnDetaching()
+ RemoveHandler View.ValidateRow, AddressOf OnValidateRow
+ RemoveHandler View.PreviewKeyDown, AddressOf OnPreviewKeyDown
+ UpdateErrorText()
+ MyBase.OnDetaching()
+ End Sub
+
+ Private Sub UpdateErrorText()
+ If View Is Nothing Then
+ Return
+ End If
+ If NoRecordsErrorMessage IsNot Nothing Then
+ View.ShowEmptyText = True
+ View.RuntimeLocalizationStrings = New GridRuntimeStringCollection() From {New RuntimeStringIdInfo(GridControlRuntimeStringId.NoRecords, NoRecordsErrorMessage)}
+ Else
+ View.ShowEmptyText = False
+ View.RuntimeLocalizationStrings = Nothing
+ End If
+ End Sub
+
+ Private Sub OnPreviewKeyDown(ByVal sender As Object, ByVal e As KeyEventArgs)
+ If e.Key = Key.Delete AndAlso CanDelete() Then
+ DoDelete()
+ e.Handled = True
+ End If
+ If e.Key = Key.F5 AndAlso CanRefresh() Then
+ DoRefresh()
+ e.Handled = True
+ End If
+ End Sub
+
+ Private Sub DoRefresh()
+ OnRefreshCommand.Execute(Nothing)
+ End Sub
+ Private Function CanRefresh() As Boolean
+ Return OnRefreshCommand IsNot Nothing AndAlso Not IsEditingRowState()
+ End Function
+
+ Private Sub DoDelete()
+ Dim row = View.Grid.SelectedItem
+ If row Is Nothing Then
+ Return
+ End If
+ If DXMessageBox.Show(View, "Are you sure you want to delete this row?", "Delete Row", MessageBoxButton.OKCancel) = MessageBoxResult.Cancel Then
+ Return
+ End If
+ Try
+ OnDeleteCommand.Execute(row)
+ View.Commands.DeleteFocusedRow.Execute(Nothing)
+ Catch ex As Exception
+ DXMessageBox.Show(ex.Message)
+ End Try
+ End Sub
+
+ Private Function CanDelete() As Boolean
+ Return OnDeleteCommand IsNot Nothing AndAlso Not IsEditingRowState()
+ End Function
+
+ Private Function IsEditingRowState() As Boolean
+ Return View?.AreUpdateRowButtonsShown = True
+ End Function
+
+ Private Sub OnValidateRow(ByVal sender As Object, ByVal e As GridRowValidationEventArgs)
+ If View.FocusedRowHandle = DataControlBase.NewItemRowHandle Then
+ OnCreateCommand.Execute(e.Row)
+ Else
+ OnUpdateCommand.Execute(e.Row)
+ End If
+ End Sub
+ End Class
+End Namespace
diff --git a/VB/GridControlCRUDMVVM/Common.ViewModel/CollectionViewModel.vb b/VB/GridControlCRUDMVVM/Common.ViewModel/CollectionViewModel.vb
new file mode 100644
index 0000000..53c32d2
--- /dev/null
+++ b/VB/GridControlCRUDMVVM/Common.ViewModel/CollectionViewModel.vb
@@ -0,0 +1,56 @@
+Imports DevExpress.CRUD.DataModel
+Imports DevExpress.Mvvm
+Imports System.Collections.Generic
+Imports System.Windows.Input
+
+Namespace DevExpress.CRUD.ViewModel
+ Public MustInherit Class CollectionViewModel(Of T As Class)
+ Inherits ViewModelBase
+
+ Private ReadOnly dataProvider As ICRUDDataProvider(Of T)
+
+ Protected Sub New(ByVal dataProvider As ICRUDDataProvider(Of T))
+ Me.dataProvider = dataProvider
+ OnRefresh()
+ OnRefreshCommand = New DelegateCommand(AddressOf OnRefresh)
+ OnCreateCommand = New DelegateCommand(Of T)(AddressOf Me.dataProvider.Create)
+ OnUpdateCommand = New DelegateCommand(Of T)(AddressOf Me.dataProvider.Update)
+ OnDeleteCommand = New DelegateCommand(Of T)(AddressOf Me.dataProvider.Delete)
+ End Sub
+
+ Public ReadOnly Property OnRefreshCommand() As ICommand
+ Public ReadOnly Property OnCreateCommand() As ICommand(Of T)
+ Public ReadOnly Property OnUpdateCommand() As ICommand(Of T)
+ Public ReadOnly Property OnDeleteCommand() As ICommand(Of T)
+
+ Public Property Entities() As IList(Of T)
+ Get
+ Return GetValue(Of IList(Of T))()
+ End Get
+ Private Set(ByVal value As IList(Of T))
+ SetValue(value)
+ End Set
+ End Property
+ Public Property EntitiesErrorMessage() As String
+ Get
+ Return GetValue(Of String)()
+ End Get
+ Private Set(ByVal value As String)
+ SetValue(value)
+ End Set
+ End Property
+
+ Private Sub OnRefresh()
+ Try
+ Entities = dataProvider.Read()
+ EntitiesErrorMessage = Nothing
+ Catch
+ Entities = Nothing
+ EntitiesErrorMessage = "An error has occurred while establishing a connection to the database. Press F5 to retry the connection."
+ End Try
+ OnRefreshCore()
+ End Sub
+ Protected Overridable Sub OnRefreshCore()
+ End Sub
+ End Class
+End Namespace
diff --git a/VB/GridControlCRUDMVVM/GridControlCRUDMVVM.sln b/VB/GridControlCRUDMVVM/GridControlCRUDMVVM.sln
new file mode 100644
index 0000000..2e089b5
--- /dev/null
+++ b/VB/GridControlCRUDMVVM/GridControlCRUDMVVM.sln
@@ -0,0 +1,24 @@
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.29806.167
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "GridControlCRUDMVVM", "GridControlCRUDMVVM.vbproj", "{69E85A61-E7D4-4C9D-A433-13E742AE30BC}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {69E85A61-E7D4-4C9D-A433-13E742AE30BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {69E85A61-E7D4-4C9D-A433-13E742AE30BC}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {69E85A61-E7D4-4C9D-A433-13E742AE30BC}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {69E85A61-E7D4-4C9D-A433-13E742AE30BC}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {51597E69-ADA1-4945-9493-FC7C9FB65AD2}
+ EndGlobalSection
+EndGlobal
diff --git a/VB/GridControlCRUDMVVM/GridControlCRUDMVVM.vbproj b/VB/GridControlCRUDMVVM/GridControlCRUDMVVM.vbproj
new file mode 100644
index 0000000..f2c49bf
--- /dev/null
+++ b/VB/GridControlCRUDMVVM/GridControlCRUDMVVM.vbproj
@@ -0,0 +1,226 @@
+
+
+
+
+
+ Debug
+ AnyCPU
+ {69E85A61-E7D4-4C9D-A433-13E742AE30BC}
+ WinExe
+
+ GridControlCRUDMVVM
+ v4.5.2
+ 512
+ {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{F184B08F-C81C-45F6-A57F-5ABD9991F28F}
+ true
+ true
+
+ On
+ Binary
+ Off
+ On
+
+
+ AnyCPU
+ true
+ full
+ false
+ bin\Debug\
+ true
+ true
+ prompt
+ true
+
+
+ AnyCPU
+ pdbonly
+ true
+ bin\Release\
+ false
+ true
+ prompt
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ True
+ E:\DXDLLS\20.1.4\DevExpress.Data.v20.1.dll
+
+
+ True
+ E:\DXDLLS\20.1.4\DevExpress.Data.Desktop.v20.1.dll
+
+
+ True
+ E:\DXDLLS\20.1.4\DevExpress.Images.v20.1.dll
+
+
+ True
+ E:\DXDLLS\20.1.4\DevExpress.Mvvm.v20.1.dll
+
+
+ True
+ E:\DXDLLS\20.1.4\DevExpress.Printing.v20.1.Core.dll
+
+
+ True
+ E:\DXDLLS\20.1.4\DevExpress.Xpf.Core.v20.1.dll
+
+
+ True
+ E:\DXDLLS\20.1.4\DevExpress.Xpf.Printing.v20.1.dll
+
+
+ True
+ E:\DXDLLS\20.1.4\DevExpress.Xpf.Grid.v20.1.dll
+
+
+ True
+ E:\DXDLLS\20.1.4\DevExpress.Xpf.Grid.v20.1.Core.dll
+
+
+ True
+ E:\DXDLLS\20.1.4\DevExpress.Xpf.Grid.v20.1.Extensions.dll
+
+
+ ..\packages\EntityFramework.6.4.0\lib\net45\EntityFramework.dll
+
+
+ ..\packages\EntityFramework.6.4.0\lib\net45\EntityFramework.SqlServer.dll
+
+
+
+
+
+
+
+
+
+
+
+ 4.0
+
+
+
+
+
+
+
+ MSBuild:Compile
+ Designer
+
+
+ Common.DataModel\DesignTimeDataProvider.vb
+
+
+ Common.DataModel.EntityFramework\EntityFrameworkCRUDDataProvider.vb
+
+
+ Common.DataModel.EntityFramework\EntityFrameworkDataProvider.vb
+
+
+ Common.DataModel\ICRUDDataProvider.vb
+
+
+ Common.DataModel\IDataProvider.vb
+
+
+ Northwind.DataModel\NorthwindDataStorage.vb
+
+
+ Northwind.DataModel\NorthwindDataStorageFactory.vb
+
+
+
+
+
+ MSBuild:Compile
+ Designer
+
+
+ Northwind.DataModel\CategoryInfo.vb
+
+
+ Northwind.DataModel\ProductInfo.vb
+
+
+ Northwind\Category.vb
+
+
+ Northwind\NorthwindContext.vb
+
+
+ Northwind\NorthwindContextInitializer.vb
+
+
+ Northwind\Product.vb
+
+
+ Application.xaml
+ Code
+
+
+ MainWindow.xaml
+ Code
+
+
+
+
+ Code
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ Settings.settings
+ True
+
+
+ VbMyResourcesResXFileCodeGenerator
+ Resources.Designer.vb
+ My.Resources
+
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.vb
+ My
+
+
+
+
+
+
+
+
+
+ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
+
+
+
+
+
+
\ No newline at end of file
diff --git a/VB/GridControlCRUDMVVM/MainWindow.xaml b/VB/GridControlCRUDMVVM/MainWindow.xaml
new file mode 100644
index 0000000..ea30b94
--- /dev/null
+++ b/VB/GridControlCRUDMVVM/MainWindow.xaml
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/VB/GridControlCRUDMVVM/MainWindow.xaml.vb b/VB/GridControlCRUDMVVM/MainWindow.xaml.vb
new file mode 100644
index 0000000..d182ba6
--- /dev/null
+++ b/VB/GridControlCRUDMVVM/MainWindow.xaml.vb
@@ -0,0 +1,11 @@
+Imports DevExpress.Xpf.Core
+
+Namespace GridControlCRUDMVVM
+ Partial Public Class MainWindow
+ Inherits ThemedWindow
+
+ Public Sub New()
+ InitializeComponent()
+ End Sub
+ End Class
+End Namespace
diff --git a/VB/GridControlCRUDMVVM/My Project/AssemblyInfo.vb b/VB/GridControlCRUDMVVM/My Project/AssemblyInfo.vb
new file mode 100644
index 0000000..427be76
--- /dev/null
+++ b/VB/GridControlCRUDMVVM/My Project/AssemblyInfo.vb
@@ -0,0 +1,48 @@
+Imports System.Reflection
+Imports System.Resources
+Imports System.Runtime.CompilerServices
+Imports System.Runtime.InteropServices
+Imports System.Windows
+
+' General Information about an assembly is controlled through the following
+' set of attributes. Change these attribute values to modify the information
+' associated with an assembly.
+
+
+
+
+
+
+
+
+
+' Setting ComVisible to false makes the types in this assembly not visible
+' to COM components. If you need to access a type in this assembly from
+' COM, set the ComVisible attribute to true on that type.
+
+
+'In order to begin building localizable applications, set
+'CultureYouAreCodingWith in your .csproj file
+'inside a . For example, if you are using US english
+'in your source files, set the to en-US. Then uncomment
+'the NeutralResourceLanguage attribute below. Update the "en-US" in
+'the line below to match the UICulture setting in the project file.
+
+'[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
+
+
+
+
+
+' Version information for an assembly consists of the following four values:
+'
+' Major Version
+' Minor Version
+' Build Number
+' Revision
+'
+' You can specify all the values or you can default the Build and Revision Numbers
+' by using the '*' as shown below:
+' [assembly: AssemblyVersion("1.0.*")]
+
+
diff --git a/VB/GridControlCRUDMVVM/My Project/Resources.Designer.vb b/VB/GridControlCRUDMVVM/My Project/Resources.Designer.vb
new file mode 100644
index 0000000..5b98c08
--- /dev/null
+++ b/VB/GridControlCRUDMVVM/My Project/Resources.Designer.vb
@@ -0,0 +1,63 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:4.0.30319.42000
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Namespace My.Resources
+
+
+ '''
+ ''' A strongly-typed resource class, for looking up localized strings, etc.
+ '''
+ ' This class was auto-generated by the StronglyTypedResourceBuilder
+ ' class via a tool like ResGen or Visual Studio.
+ ' To add or remove a member, edit your .ResX file then rerun ResGen
+ ' with the /str option, or rebuild your VS project.
+
+
+
+ Friend Module Resources
+
+ Private resourceMan As Global.System.Resources.ResourceManager
+
+ Private resourceCulture As Global.System.Globalization.CultureInfo
+
+' internal Resources()
+' {
+' }
+
+ '''
+ ''' Returns the cached ResourceManager instance used by this class.
+ '''
+
+ Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
+ Get
+ If (resourceMan Is Nothing) Then
+ Dim temp As New Global.System.Resources.ResourceManager("Resources", GetType(Resources).Assembly)
+ resourceMan = temp
+ End If
+ Return resourceMan
+ End Get
+ End Property
+
+ '''
+ ''' Overrides the current thread's CurrentUICulture property for all
+ ''' resource lookups using this strongly typed resource class.
+ '''
+
+ Friend Property Culture() As Global.System.Globalization.CultureInfo
+ Get
+ Return resourceCulture
+ End Get
+ Set(ByVal value As System.Globalization.CultureInfo)
+ resourceCulture = value
+ End Set
+ End Property
+ End Module
+End Namespace
diff --git a/VB/GridControlCRUDMVVM/My Project/Resources.resx b/VB/GridControlCRUDMVVM/My Project/Resources.resx
new file mode 100644
index 0000000..af7dbeb
--- /dev/null
+++ b/VB/GridControlCRUDMVVM/My Project/Resources.resx
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/VB/GridControlCRUDMVVM/My Project/Settings.Designer.vb b/VB/GridControlCRUDMVVM/My Project/Settings.Designer.vb
new file mode 100644
index 0000000..bdf1141
--- /dev/null
+++ b/VB/GridControlCRUDMVVM/My Project/Settings.Designer.vb
@@ -0,0 +1,27 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:4.0.30319.42000
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Namespace My
+
+
+
+
+ Friend NotInheritable Partial Class Settings
+ Inherits System.Configuration.ApplicationSettingsBase
+
+ Private Shared defaultInstance As Settings = (CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New Settings()), Settings))
+
+ Public Shared ReadOnly Property [Default]() As Settings
+ Get
+ Return defaultInstance
+ End Get
+ End Property
+ End Class
+End Namespace
diff --git a/VB/GridControlCRUDMVVM/My Project/Settings.settings b/VB/GridControlCRUDMVVM/My Project/Settings.settings
new file mode 100644
index 0000000..033d7a5
--- /dev/null
+++ b/VB/GridControlCRUDMVVM/My Project/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/VB/GridControlCRUDMVVM/Northwind.ViewModel/ProductCollectionViewModel.vb b/VB/GridControlCRUDMVVM/Northwind.ViewModel/ProductCollectionViewModel.vb
new file mode 100644
index 0000000..4d55c57
--- /dev/null
+++ b/VB/GridControlCRUDMVVM/Northwind.ViewModel/ProductCollectionViewModel.vb
@@ -0,0 +1,41 @@
+Imports DevExpress.CRUD.DataModel
+Imports DevExpress.CRUD.Northwind.DataModel
+Imports DevExpress.CRUD.ViewModel
+Imports System.Collections.Generic
+
+Namespace DevExpress.CRUD.Northwind.ViewModel
+ Public Class ProductCollectionViewModel
+ Inherits CollectionViewModel(Of ProductInfo)
+
+ Public Property Categories() As IList(Of CategoryInfo)
+ Get
+ Return GetValue(Of IList(Of CategoryInfo))()
+ End Get
+ Private Set(ByVal value As IList(Of CategoryInfo))
+ SetValue(value)
+ End Set
+ End Property
+
+ Private ReadOnly categoriesDataProvider As IDataProvider(Of CategoryInfo)
+
+ Public Sub New()
+ Me.New(NorthwindDataStorageFactory.Create(IsInDesignMode))
+ End Sub
+
+ Public Sub New(ByVal dataStorage As NorthwindDataStorage)
+ MyBase.New(dataStorage.Products)
+ categoriesDataProvider = dataStorage.Categories
+ OnRefreshCore()
+ End Sub
+
+ Protected Overrides Sub OnRefreshCore()
+ If categoriesDataProvider IsNot Nothing Then
+ Try
+ Categories = categoriesDataProvider.Read()
+ Catch
+ Categories = Nothing
+ End Try
+ End If
+ End Sub
+ End Class
+End Namespace
diff --git a/VB/GridControlCRUDMVVM/packages.config b/VB/GridControlCRUDMVVM/packages.config
new file mode 100644
index 0000000..9985587
--- /dev/null
+++ b/VB/GridControlCRUDMVVM/packages.config
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/VB/GridControlCRUDMVVMAsync/App.config b/VB/GridControlCRUDMVVMAsync/App.config
new file mode 100644
index 0000000..2484a16
--- /dev/null
+++ b/VB/GridControlCRUDMVVMAsync/App.config
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/VB/GridControlCRUDMVVMAsync/Application.xaml b/VB/GridControlCRUDMVVMAsync/Application.xaml
new file mode 100644
index 0000000..0f16619
--- /dev/null
+++ b/VB/GridControlCRUDMVVMAsync/Application.xaml
@@ -0,0 +1,9 @@
+
+
+
+
+
diff --git a/VB/GridControlCRUDMVVMAsync/Application.xaml.vb b/VB/GridControlCRUDMVVMAsync/Application.xaml.vb
new file mode 100644
index 0000000..815ef72
--- /dev/null
+++ b/VB/GridControlCRUDMVVMAsync/Application.xaml.vb
@@ -0,0 +1,14 @@
+Imports DevExpress.Mvvm
+Imports DevExpress.Xpf.Core
+Imports System.Windows
+
+Namespace GridControlCRUDMVVMAsync
+ Partial Public Class App
+ Inherits Application
+
+ Public Sub New()
+ ApplicationThemeHelper.UpdateApplicationThemeName()
+ DevExpress.Internal.DbEngineDetector.PatchConnectionStringsAndConfigureEntityFrameworkDefaultConnectionFactory()
+ End Sub
+ End Class
+End Namespace
diff --git a/VB/GridControlCRUDMVVMAsync/Common.View/GridControlCRUDAsyncBehavior.vb b/VB/GridControlCRUDMVVMAsync/Common.View/GridControlCRUDAsyncBehavior.vb
new file mode 100644
index 0000000..ec4b9b0
--- /dev/null
+++ b/VB/GridControlCRUDMVVMAsync/Common.View/GridControlCRUDAsyncBehavior.vb
@@ -0,0 +1,157 @@
+Imports DevExpress.Mvvm
+Imports DevExpress.Mvvm.UI.Interactivity
+Imports DevExpress.Xpf.Core
+Imports DevExpress.Xpf.Grid
+Imports System
+Imports System.ComponentModel
+Imports System.Threading.Tasks
+Imports System.Windows
+Imports System.Windows.Input
+
+Namespace DevExpress.CRUD.View
+ Public Class GridControlCRUDAsyncBehavior
+ Inherits Behavior(Of TableView)
+
+ Public Property OnCreateCommand() As AsyncCommand(Of Object)
+ Get
+ Return CType(GetValue(OnCreateCommandProperty), AsyncCommand(Of Object))
+ End Get
+ Set(ByVal value As AsyncCommand(Of Object))
+ SetValue(OnCreateCommandProperty, value)
+ End Set
+ End Property
+ Public Shared ReadOnly OnCreateCommandProperty As DependencyProperty = DependencyProperty.Register("OnCreateCommand", GetType(AsyncCommand(Of Object)), GetType(GridControlCRUDAsyncBehavior), New PropertyMetadata(Nothing))
+
+ Public Property OnUpdateCommand() As AsyncCommand(Of Object)
+ Get
+ Return CType(GetValue(OnUpdateCommandProperty), AsyncCommand(Of Object))
+ End Get
+ Set(ByVal value As AsyncCommand(Of Object))
+ SetValue(OnUpdateCommandProperty, value)
+ End Set
+ End Property
+ Public Shared ReadOnly OnUpdateCommandProperty As DependencyProperty = DependencyProperty.Register("OnUpdateCommand", GetType(AsyncCommand(Of Object)), GetType(GridControlCRUDAsyncBehavior), New PropertyMetadata(Nothing))
+
+ Public Property OnDeleteCommand() As ICommand
+ Get
+ Return DirectCast(GetValue(OnDeleteCommandProperty), ICommand)
+ End Get
+ Set(ByVal value As ICommand)
+ SetValue(OnDeleteCommandProperty, value)
+ End Set
+ End Property
+ Public Shared ReadOnly OnDeleteCommandProperty As DependencyProperty = DependencyProperty.Register("OnDeleteCommand", GetType(ICommand), GetType(GridControlCRUDAsyncBehavior), New PropertyMetadata(Nothing))
+
+ Public Property OnRefreshCommand() As AsyncCommand
+ Get
+ Return CType(GetValue(OnRefreshCommandProperty), AsyncCommand)
+ End Get
+ Set(ByVal value As AsyncCommand)
+ SetValue(OnRefreshCommandProperty, value)
+ End Set
+ End Property
+ Public Shared ReadOnly OnRefreshCommandProperty As DependencyProperty = DependencyProperty.Register("OnRefreshCommand", GetType(AsyncCommand), GetType(GridControlCRUDAsyncBehavior), New PropertyMetadata(Nothing))
+
+ Public Property NoRecordsErrorMessage() As String
+ Get
+ Return CStr(GetValue(NoRecordsErrorMessageProperty))
+ End Get
+ Set(ByVal value As String)
+ SetValue(NoRecordsErrorMessageProperty, value)
+ End Set
+ End Property
+ Public Shared ReadOnly NoRecordsErrorMessageProperty As DependencyProperty = DependencyProperty.Register("NoRecordsErrorMessage", GetType(String), GetType(GridControlCRUDAsyncBehavior), New PropertyMetadata(Nothing, Sub(d, e) (CType(d, GridControlCRUDAsyncBehavior)).UpdateErrorText()))
+
+
+ Public ReadOnly Property DeleteCommand() As ICommand
+ Public ReadOnly Property RefreshCommand() As ICommand
+
+ Private ReadOnly Property View() As TableView
+ Get
+ Return AssociatedObject
+ End Get
+ End Property
+
+ Public Sub New()
+ DeleteCommand = New DelegateCommand(AddressOf DoDelete, AddressOf CanDelete)
+ RefreshCommand = New AsyncCommand(AddressOf DoRefresh, AddressOf CanRefresh)
+ End Sub
+
+ Protected Overrides Sub OnAttached()
+ MyBase.OnAttached()
+ AddHandler View.ValidateRow, AddressOf OnValidateRow
+ AddHandler View.PreviewKeyDown, AddressOf OnPreviewKeyDown
+ UpdateErrorText()
+ End Sub
+
+ Protected Overrides Sub OnDetaching()
+ RemoveHandler View.ValidateRow, AddressOf OnValidateRow
+ RemoveHandler View.PreviewKeyDown, AddressOf OnPreviewKeyDown
+ UpdateErrorText()
+ MyBase.OnDetaching()
+ End Sub
+
+ Private Sub UpdateErrorText()
+ If View Is Nothing Then
+ Return
+ End If
+ If NoRecordsErrorMessage IsNot Nothing Then
+ View.ShowEmptyText = True
+ View.RuntimeLocalizationStrings = New GridRuntimeStringCollection() From {New RuntimeStringIdInfo(GridControlRuntimeStringId.NoRecords, NoRecordsErrorMessage)}
+ Else
+ View.ShowEmptyText = False
+ View.RuntimeLocalizationStrings = Nothing
+ End If
+ End Sub
+
+ Private Async Sub OnPreviewKeyDown(ByVal sender As Object, ByVal e As KeyEventArgs)
+ If e.Key = Key.Delete AndAlso CanDelete() Then
+ DoDelete()
+ e.Handled = True
+ End If
+ If e.Key = Key.F5 AndAlso CanRefresh() Then
+ Await DoRefresh()
+ e.Handled = True
+ End If
+ End Sub
+
+ Private Function DoRefresh() As Task
+ Return OnRefreshCommand.ExecuteAsync(Nothing)
+ End Function
+ Private Function CanRefresh() As Boolean
+ Return OnRefreshCommand IsNot Nothing AndAlso Not IsEditingRowState() AndAlso Not OnRefreshCommand.IsExecuting AndAlso (View?.Grid.ItemsSource IsNot Nothing OrElse NoRecordsErrorMessage IsNot Nothing)
+ End Function
+
+ Private Sub DoDelete()
+ Dim row = View.Grid.SelectedItem
+ If row Is Nothing Then
+ Return
+ End If
+ If DXMessageBox.Show(View, "Are you sure you want to delete this row?", "Delete Row", MessageBoxButton.OKCancel) = MessageBoxResult.Cancel Then
+ Return
+ End If
+ Try
+ OnDeleteCommand.Execute(row)
+ View.Commands.DeleteFocusedRow.Execute(Nothing)
+ Catch ex As Exception
+ DXMessageBox.Show(ex.Message)
+ End Try
+ End Sub
+
+ Private Function CanDelete() As Boolean
+ Return OnDeleteCommand IsNot Nothing AndAlso Not IsEditingRowState() AndAlso Not OnRefreshCommand.IsExecuting AndAlso View?.Grid.CurrentItem IsNot Nothing
+ End Function
+
+ Private Function IsEditingRowState() As Boolean
+ Return View?.AreUpdateRowButtonsShown = True
+ End Function
+
+ Private Sub OnValidateRow(ByVal sender As Object, ByVal e As GridRowValidationEventArgs)
+ If View.FocusedRowHandle = DataControlBase.NewItemRowHandle Then
+ e.UpdateRowResult = OnCreateCommand.ExecuteAsync(e.Row)
+ Else
+ e.UpdateRowResult = OnUpdateCommand.ExecuteAsync(e.Row)
+ End If
+ End Sub
+ End Class
+End Namespace
diff --git a/VB/GridControlCRUDMVVMAsync/Common.View/GridControlCRUDBehavior.vb b/VB/GridControlCRUDMVVMAsync/Common.View/GridControlCRUDBehavior.vb
new file mode 100644
index 0000000..5f6fd4f
--- /dev/null
+++ b/VB/GridControlCRUDMVVMAsync/Common.View/GridControlCRUDBehavior.vb
@@ -0,0 +1,147 @@
+Option Infer On
+
+Imports DevExpress.Mvvm
+Imports DevExpress.Mvvm.UI.Interactivity
+Imports DevExpress.Xpf.Core
+Imports DevExpress.Xpf.Grid
+Imports System
+Imports System.Windows
+Imports System.Windows.Input
+
+Namespace DevExpress.CRUD.View
+ Public Class GridControlCRUDBehavior
+ Inherits Behavior(Of TableView)
+
+ Public Property OnCreateCommand() As ICommand
+ Get
+ Return DirectCast(GetValue(OnCreateCommandProperty), ICommand)
+ End Get
+ Set(ByVal value As ICommand)
+ SetValue(OnCreateCommandProperty, value)
+ End Set
+ End Property
+ Public Shared ReadOnly OnCreateCommandProperty As DependencyProperty = DependencyProperty.Register("OnCreateCommand", GetType(ICommand), GetType(GridControlCRUDBehavior), New PropertyMetadata(Nothing))
+
+ Public Property OnUpdateCommand() As ICommand
+ Get
+ Return DirectCast(GetValue(OnUpdateCommandProperty), ICommand)
+ End Get
+ Set(ByVal value As ICommand)
+ SetValue(OnUpdateCommandProperty, value)
+ End Set
+ End Property
+ Public Shared ReadOnly OnUpdateCommandProperty As DependencyProperty = DependencyProperty.Register("OnUpdateCommand", GetType(ICommand), GetType(GridControlCRUDBehavior), New PropertyMetadata(Nothing))
+
+ Public Property OnDeleteCommand() As ICommand
+ Get
+ Return DirectCast(GetValue(OnDeleteCommandProperty), ICommand)
+ End Get
+ Set(ByVal value As ICommand)
+ SetValue(OnDeleteCommandProperty, value)
+ End Set
+ End Property
+ Public Shared ReadOnly OnDeleteCommandProperty As DependencyProperty = DependencyProperty.Register("OnDeleteCommand", GetType(ICommand), GetType(GridControlCRUDBehavior), New PropertyMetadata(Nothing))
+
+ Public Property OnRefreshCommand() As ICommand
+ Get
+ Return DirectCast(GetValue(OnRefreshCommandProperty), ICommand)
+ End Get
+ Set(ByVal value As ICommand)
+ SetValue(OnRefreshCommandProperty, value)
+ End Set
+ End Property
+ Public Shared ReadOnly OnRefreshCommandProperty As DependencyProperty = DependencyProperty.Register("OnRefreshCommand", GetType(ICommand), GetType(GridControlCRUDBehavior), New PropertyMetadata(Nothing))
+
+ Private privateDeleteCommand As ICommand
+ Public Property DeleteCommand() As ICommand
+ Get
+ Return privateDeleteCommand
+ End Get
+ Private Set(ByVal value As ICommand)
+ privateDeleteCommand = value
+ End Set
+ End Property
+ Private privateRefreshCommand As ICommand
+ Public Property RefreshCommand() As ICommand
+ Get
+ Return privateRefreshCommand
+ End Get
+ Private Set(ByVal value As ICommand)
+ privateRefreshCommand = value
+ End Set
+ End Property
+
+ Private ReadOnly Property View() As TableView
+ Get
+ Return AssociatedObject
+ End Get
+ End Property
+
+ Public Sub New()
+ DeleteCommand = New DelegateCommand(AddressOf DoDelete, AddressOf CanDelete)
+ RefreshCommand = New DelegateCommand(AddressOf DoRefresh, AddressOf CanRefresh)
+ End Sub
+
+ Protected Overrides Sub OnAttached()
+ MyBase.OnAttached()
+ AddHandler View.ValidateRow, AddressOf OnValidateRow
+ AddHandler View.PreviewKeyDown, AddressOf OnPreviewKeyDown
+ End Sub
+
+ Protected Overrides Sub OnDetaching()
+ RemoveHandler View.ValidateRow, AddressOf OnValidateRow
+ RemoveHandler View.PreviewKeyDown, AddressOf OnPreviewKeyDown
+ MyBase.OnDetaching()
+ End Sub
+
+ Private Sub OnPreviewKeyDown(ByVal sender As Object, ByVal e As KeyEventArgs)
+ If e.Key = Key.Delete AndAlso CanDelete() Then
+ DoDelete()
+ e.Handled = True
+ End If
+ If e.Key = Key.F5 AndAlso CanRefresh() Then
+ DoRefresh()
+ e.Handled = True
+ End If
+ End Sub
+
+ Private Sub DoRefresh()
+ OnRefreshCommand.Execute(Nothing)
+ End Sub
+ Private Function CanRefresh() As Boolean
+ Return OnRefreshCommand IsNot Nothing AndAlso Not IsEdtitingRowState()
+ End Function
+
+ Private Sub DoDelete()
+ Dim row = View.Grid.SelectedItem
+ If row Is Nothing Then
+ Return
+ End If
+ If DXMessageBox.Show(View, "Are you sure you want to delete this row?", "Delete Row", MessageBoxButton.OKCancel) = MessageBoxResult.Cancel Then
+ Return
+ End If
+ Try
+ OnDeleteCommand.Execute(row)
+ View.Commands.DeleteFocusedRow.Execute(Nothing)
+ Catch ex As Exception
+ DXMessageBox.Show(ex.Message)
+ End Try
+ End Sub
+
+ Private Function CanDelete() As Boolean
+ Return OnDeleteCommand IsNot Nothing AndAlso Not IsEdtitingRowState()
+ End Function
+
+ Private Function IsEdtitingRowState() As Boolean
+ Return View?.AreUpdateRowButtonsShown = True
+ End Function
+
+ Private Sub OnValidateRow(ByVal sender As Object, ByVal e As GridRowValidationEventArgs)
+ If View.FocusedRowHandle = DataControlBase.NewItemRowHandle Then
+ OnCreateCommand.Execute(e.Row)
+ Else
+ OnUpdateCommand.Execute(e.Row)
+ End If
+ End Sub
+ End Class
+End Namespace
diff --git a/VB/GridControlCRUDMVVMAsync/Common.ViewModel/CollectionViewModel.vb b/VB/GridControlCRUDMVVMAsync/Common.ViewModel/CollectionViewModel.vb
new file mode 100644
index 0000000..fb166b0
--- /dev/null
+++ b/VB/GridControlCRUDMVVMAsync/Common.ViewModel/CollectionViewModel.vb
@@ -0,0 +1,76 @@
+Imports DevExpress.CRUD.DataModel
+Imports DevExpress.Mvvm
+Imports System.Collections.Generic
+Imports System.Threading.Tasks
+
+Namespace DevExpress.CRUD.ViewModel
+ Public MustInherit Class CollectionViewModel(Of T As Class)
+ Inherits ViewModelBase
+
+ Private ReadOnly dataProvider As ICRUDDataProvider(Of T)
+
+ Protected Sub New(ByVal dataProvider As ICRUDDataProvider(Of T))
+ Me.dataProvider = dataProvider
+ StartRefresh()
+ OnRefreshCommand = New AsyncCommand(AddressOf OnRefreshAsync)
+ OnCreateCommand = New AsyncCommand(Of Object)(Function(entity) Me.dataProvider.CreateAsync(CType(entity, T)))
+ OnUpdateCommand = New AsyncCommand(Of Object)(Function(entity) Me.dataProvider.UpdateAsync(CType(entity, T)))
+ OnDeleteCommand = New DelegateCommand(Of T)(AddressOf Me.dataProvider.Delete)
+ End Sub
+
+ Public ReadOnly Property OnRefreshCommand() As AsyncCommand
+ Public ReadOnly Property OnCreateCommand() As AsyncCommand(Of Object)
+ Public ReadOnly Property OnUpdateCommand() As AsyncCommand(Of Object)
+ Public ReadOnly Property OnDeleteCommand() As ICommand(Of T)
+
+ Public Property Entities() As IList(Of T)
+ Get
+ Return GetValue(Of IList(Of T))()
+ End Get
+ Private Set(ByVal value As IList(Of T))
+ SetValue(value)
+ End Set
+ End Property
+ Public Property EntitiesErrorMessage() As String
+ Get
+ Return GetValue(Of String)()
+ End Get
+ Private Set(ByVal value As String)
+ SetValue(value)
+ End Set
+ End Property
+ Public Property IsLoading() As Boolean
+ Get
+ Return GetValue(Of Boolean)()
+ End Get
+ Private Set(ByVal value As Boolean)
+ SetValue(value)
+ End Set
+ End Property
+
+ Private Async Sub StartRefresh()
+ Await OnRefreshAsync()
+ End Sub
+
+ Private Async Function OnRefreshAsync() As Task
+ IsLoading = True
+ Try
+ Await Task.WhenAll(RefreshEntities(), OnRefreshCoreAsync())
+ Finally
+ IsLoading = False
+ End Try
+ End Function
+ Private Async Function RefreshEntities() As Task
+ Try
+ Entities = Await dataProvider.ReadAsync()
+ EntitiesErrorMessage = Nothing
+ Catch
+ Entities = Nothing
+ EntitiesErrorMessage = "An error has occurred while establishing a connection to the database. Press F5 to retry the connection."
+ End Try
+ End Function
+ Protected Overridable Function OnRefreshCoreAsync() As Task
+ Return Task.CompletedTask
+ End Function
+ End Class
+End Namespace
diff --git a/VB/GridControlCRUDMVVMAsync/Common.ViewModel/DataProviderAsyncExtensions.vb b/VB/GridControlCRUDMVVMAsync/Common.ViewModel/DataProviderAsyncExtensions.vb
new file mode 100644
index 0000000..70850bd
--- /dev/null
+++ b/VB/GridControlCRUDMVVMAsync/Common.ViewModel/DataProviderAsyncExtensions.vb
@@ -0,0 +1,29 @@
+Imports DevExpress.CRUD.DataModel
+Imports System.Collections.Generic
+Imports System.Threading.Tasks
+
+Namespace DevExpress.CRUD.ViewModel
+ Public Module DataProviderAsyncExtensions
+ _
+ Public Async Function ReadAsync(Of T As Class)(ByVal dataProvider As IDataProvider(Of T)) As Task(Of IList(Of T))
+#If DEBUG Then
+ Await Task.Delay(500)
+#End If
+ Return Await Task.Run(AddressOf dataProvider.Read)
+ End Function
+ _
+ Public Async Function UpdateAsync(Of T As Class)(ByVal dataProvider As ICRUDDataProvider(Of T), ByVal entity As T) As Task
+#If DEBUG Then
+ Await Task.Delay(500)
+#End If
+ Await Task.Run(Sub() dataProvider.Update(entity))
+ End Function
+ _
+ Public Async Function CreateAsync(Of T As Class)(ByVal dataProvider As ICRUDDataProvider(Of T), ByVal entity As T) As Task
+#If DEBUG Then
+ Await Task.Delay(500)
+#End If
+ Await Task.Run(Sub() dataProvider.Create(entity))
+ End Function
+ End Module
+End Namespace
diff --git a/VB/GridControlCRUDMVVMAsync/GridControlCRUDMVVMAsync.sln b/VB/GridControlCRUDMVVMAsync/GridControlCRUDMVVMAsync.sln
new file mode 100644
index 0000000..cd39696
--- /dev/null
+++ b/VB/GridControlCRUDMVVMAsync/GridControlCRUDMVVMAsync.sln
@@ -0,0 +1,24 @@
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.29806.167
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "GridControlCRUDMVVMAsync", "GridControlCRUDMVVMAsync.vbproj", "{659194A7-745D-4A56-A683-B150B9170F53}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {659194A7-745D-4A56-A683-B150B9170F53}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {659194A7-745D-4A56-A683-B150B9170F53}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {659194A7-745D-4A56-A683-B150B9170F53}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {659194A7-745D-4A56-A683-B150B9170F53}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {51597E69-ADA1-4945-9493-FC7C9FB65AD2}
+ EndGlobalSection
+EndGlobal
diff --git a/VB/GridControlCRUDMVVMAsync/GridControlCRUDMVVMAsync.vbproj b/VB/GridControlCRUDMVVMAsync/GridControlCRUDMVVMAsync.vbproj
new file mode 100644
index 0000000..0bf42db
--- /dev/null
+++ b/VB/GridControlCRUDMVVMAsync/GridControlCRUDMVVMAsync.vbproj
@@ -0,0 +1,227 @@
+
+
+
+
+
+ Debug
+ AnyCPU
+ {659194A7-745D-4A56-A683-B150B9170F53}
+ WinExe
+
+ GridControlCRUDMVVMAsync
+ v4.6
+ 512
+ {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{F184B08F-C81C-45F6-A57F-5ABD9991F28F}
+ true
+ true
+
+ On
+ Binary
+ Off
+ On
+
+
+ AnyCPU
+ true
+ full
+ false
+ bin\Debug\
+ true
+ true
+ prompt
+ true
+
+
+ AnyCPU
+ pdbonly
+ true
+ bin\Release\
+ false
+ true
+ prompt
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ True
+ E:\DXDLLS\20.1.4\DevExpress.Data.v20.1.dll
+
+
+ True
+ E:\DXDLLS\20.1.4\DevExpress.Data.Desktop.v20.1.dll
+
+
+ True
+ E:\DXDLLS\20.1.4\DevExpress.Images.v20.1.dll
+
+
+ True
+ E:\DXDLLS\20.1.4\DevExpress.Mvvm.v20.1.dll
+
+
+ True
+ E:\DXDLLS\20.1.4\DevExpress.Printing.v20.1.Core.dll
+
+
+ True
+ E:\DXDLLS\20.1.4\DevExpress.Xpf.Core.v20.1.dll
+
+
+ True
+ E:\DXDLLS\20.1.4\DevExpress.Xpf.Printing.v20.1.dll
+
+
+ True
+ E:\DXDLLS\20.1.4\DevExpress.Xpf.Grid.v20.1.dll
+
+
+ True
+ E:\DXDLLS\20.1.4\DevExpress.Xpf.Grid.v20.1.Core.dll
+
+
+ True
+ E:\DXDLLS\20.1.4\DevExpress.Xpf.Grid.v20.1.Extensions.dll
+
+
+ ..\packages\EntityFramework.6.4.0\lib\net45\EntityFramework.dll
+
+
+ ..\packages\EntityFramework.6.4.0\lib\net45\EntityFramework.SqlServer.dll
+
+
+
+
+
+
+
+
+
+
+
+ 4.0
+
+
+
+
+
+
+
+ MSBuild:Compile
+ Designer
+
+
+ Common.DataModel\DesignTimeDataProvider.vb
+
+
+ Common.DataModel.EntityFramework\EntityFrameworkCRUDDataProvider.vb
+
+
+ Common.DataModel.EntityFramework\EntityFrameworkDataProvider.vb
+
+
+ Common.DataModel\ICRUDDataProvider.vb
+
+
+ Common.DataModel\IDataProvider.vb
+
+
+ Northwind.DataModel\NorthwindDataStorage.vb
+
+
+ Northwind.DataModel\NorthwindDataStorageFactory.vb
+
+
+
+
+
+
+ MSBuild:Compile
+ Designer
+
+
+ Northwind.DataModel\CategoryInfo.vb
+
+
+ Northwind.DataModel\ProductInfo.vb
+
+
+ Northwind\Category.vb
+
+
+ Northwind\NorthwindContext.vb
+
+
+ Northwind\NorthwindContextInitializer.vb
+
+
+ Northwind\Product.vb
+
+
+ Application.xaml
+ Code
+
+
+ MainWindow.xaml
+ Code
+
+
+
+
+ Code
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ Settings.settings
+ True
+
+
+ VbMyResourcesResXFileCodeGenerator
+ Resources.Designer.vb
+ My.Resources
+
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.vb
+ My
+
+
+
+
+
+
+
+
+
+ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
+
+
+
+
+
+
\ No newline at end of file
diff --git a/VB/GridControlCRUDMVVMAsync/MainWindow.xaml b/VB/GridControlCRUDMVVMAsync/MainWindow.xaml
new file mode 100644
index 0000000..b4738ef
--- /dev/null
+++ b/VB/GridControlCRUDMVVMAsync/MainWindow.xaml
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/VB/GridControlCRUDMVVMAsync/MainWindow.xaml.vb b/VB/GridControlCRUDMVVMAsync/MainWindow.xaml.vb
new file mode 100644
index 0000000..ce023ac
--- /dev/null
+++ b/VB/GridControlCRUDMVVMAsync/MainWindow.xaml.vb
@@ -0,0 +1,11 @@
+Imports DevExpress.Xpf.Core
+
+Namespace GridControlCRUDMVVMAsync
+ Partial Public Class MainWindow
+ Inherits ThemedWindow
+
+ Public Sub New()
+ InitializeComponent()
+ End Sub
+ End Class
+End Namespace
diff --git a/VB/GridControlCRUDMVVMAsync/My Project/AssemblyInfo.vb b/VB/GridControlCRUDMVVMAsync/My Project/AssemblyInfo.vb
new file mode 100644
index 0000000..58cb13c
--- /dev/null
+++ b/VB/GridControlCRUDMVVMAsync/My Project/AssemblyInfo.vb
@@ -0,0 +1,48 @@
+Imports System.Reflection
+Imports System.Resources
+Imports System.Runtime.CompilerServices
+Imports System.Runtime.InteropServices
+Imports System.Windows
+
+' General Information about an assembly is controlled through the following
+' set of attributes. Change these attribute values to modify the information
+' associated with an assembly.
+
+
+
+
+
+
+
+
+
+' Setting ComVisible to false makes the types in this assembly not visible
+' to COM components. If you need to access a type in this assembly from
+' COM, set the ComVisible attribute to true on that type.
+
+
+'In order to begin building localizable applications, set
+'CultureYouAreCodingWith in your .csproj file
+'inside a . For example, if you are using US english
+'in your source files, set the to en-US. Then uncomment
+'the NeutralResourceLanguage attribute below. Update the "en-US" in
+'the line below to match the UICulture setting in the project file.
+
+'[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
+
+
+
+
+
+' Version information for an assembly consists of the following four values:
+'
+' Major Version
+' Minor Version
+' Build Number
+' Revision
+'
+' You can specify all the values or you can default the Build and Revision Numbers
+' by using the '*' as shown below:
+' [assembly: AssemblyVersion("1.0.*")]
+
+
diff --git a/VB/GridControlCRUDMVVMAsync/My Project/Resources.Designer.vb b/VB/GridControlCRUDMVVMAsync/My Project/Resources.Designer.vb
new file mode 100644
index 0000000..39f1281
--- /dev/null
+++ b/VB/GridControlCRUDMVVMAsync/My Project/Resources.Designer.vb
@@ -0,0 +1,65 @@
+Imports System
+
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:4.0.30319.42000
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Namespace My.Resources
+
+
+ '''
+ ''' A strongly-typed resource class, for looking up localized strings, etc.
+ '''
+ ' This class was auto-generated by the StronglyTypedResourceBuilder
+ ' class via a tool like ResGen or Visual Studio.
+ ' To add or remove a member, edit your .ResX file then rerun ResGen
+ ' with the /str option, or rebuild your VS project.
+
+
+
+ Friend Module Resources
+
+ Private resourceMan As Global.System.Resources.ResourceManager
+
+ Private resourceCulture As Global.System.Globalization.CultureInfo
+
+' internal Resources()
+' {
+' }
+
+ '''
+ ''' Returns the cached ResourceManager instance used by this class.
+ '''
+
+ Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
+ Get
+ If Object.ReferenceEquals(resourceMan, Nothing) Then
+ Dim temp As New Global.System.Resources.ResourceManager("Resources", GetType(Resources).Assembly)
+ resourceMan = temp
+ End If
+ Return resourceMan
+ End Get
+ End Property
+
+ '''
+ ''' Overrides the current thread's CurrentUICulture property for all
+ ''' resource lookups using this strongly typed resource class.
+ '''
+
+ Friend Property Culture() As Global.System.Globalization.CultureInfo
+ Get
+ Return resourceCulture
+ End Get
+ Set(ByVal value As System.Globalization.CultureInfo)
+ resourceCulture = value
+ End Set
+ End Property
+ End Module
+End Namespace
diff --git a/VB/GridControlCRUDMVVMAsync/My Project/Resources.resx b/VB/GridControlCRUDMVVMAsync/My Project/Resources.resx
new file mode 100644
index 0000000..af7dbeb
--- /dev/null
+++ b/VB/GridControlCRUDMVVMAsync/My Project/Resources.resx
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/VB/GridControlCRUDMVVMAsync/My Project/Settings.Designer.vb b/VB/GridControlCRUDMVVMAsync/My Project/Settings.Designer.vb
new file mode 100644
index 0000000..07eddc0
--- /dev/null
+++ b/VB/GridControlCRUDMVVMAsync/My Project/Settings.Designer.vb
@@ -0,0 +1,27 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:4.0.30319.42000
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Namespace My
+
+
+
+
+ Friend NotInheritable Partial Class Settings
+ Inherits System.Configuration.ApplicationSettingsBase
+
+ Private Shared defaultInstance As Settings = (CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New Settings()), Settings))
+
+ Public Shared ReadOnly Property [Default]() As Settings
+ Get
+ Return defaultInstance
+ End Get
+ End Property
+ End Class
+End Namespace
diff --git a/VB/GridControlCRUDMVVMAsync/My Project/Settings.settings b/VB/GridControlCRUDMVVMAsync/My Project/Settings.settings
new file mode 100644
index 0000000..033d7a5
--- /dev/null
+++ b/VB/GridControlCRUDMVVMAsync/My Project/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/VB/GridControlCRUDMVVMAsync/Northwind.ViewModel/ProductCollectionViewModel.vb b/VB/GridControlCRUDMVVMAsync/Northwind.ViewModel/ProductCollectionViewModel.vb
new file mode 100644
index 0000000..19b209b
--- /dev/null
+++ b/VB/GridControlCRUDMVVMAsync/Northwind.ViewModel/ProductCollectionViewModel.vb
@@ -0,0 +1,45 @@
+Imports DevExpress.CRUD.DataModel
+Imports DevExpress.CRUD.Northwind.DataModel
+Imports DevExpress.CRUD.ViewModel
+Imports System.Collections.Generic
+Imports System.Threading.Tasks
+
+Namespace DevExpress.CRUD.Northwind.ViewModel
+ Public Class ProductCollectionViewModel
+ Inherits CollectionViewModel(Of ProductInfo)
+
+ Public Property Categories() As IList(Of CategoryInfo)
+ Get
+ Return GetValue(Of IList(Of CategoryInfo))()
+ End Get
+ Private Set(ByVal value As IList(Of CategoryInfo))
+ SetValue(value)
+ End Set
+ End Property
+
+ Private ReadOnly categoriesDataProvider As IDataProvider(Of CategoryInfo)
+
+ Public Sub New()
+ Me.New(NorthwindDataStorageFactory.Create(IsInDesignMode))
+ End Sub
+
+ Public Sub New(ByVal dataStorage As NorthwindDataStorage)
+ MyBase.New(dataStorage.Products)
+ categoriesDataProvider = dataStorage.Categories
+ RefreshCategories()
+ End Sub
+
+ Private Async Sub RefreshCategories()
+ Await OnRefreshCoreAsync()
+ End Sub
+ Protected Overrides Async Function OnRefreshCoreAsync() As Task
+ If categoriesDataProvider IsNot Nothing Then
+ Try
+ Categories = Await categoriesDataProvider.ReadAsync()
+ Catch
+ Categories = Nothing
+ End Try
+ End If
+ End Function
+ End Class
+End Namespace
diff --git a/VB/GridControlCRUDMVVMAsync/packages.config b/VB/GridControlCRUDMVVMAsync/packages.config
new file mode 100644
index 0000000..9985587
--- /dev/null
+++ b/VB/GridControlCRUDMVVMAsync/packages.config
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/VB/GridControlCRUDSimple/App.config b/VB/GridControlCRUDSimple/App.config
new file mode 100644
index 0000000..18a536d
--- /dev/null
+++ b/VB/GridControlCRUDSimple/App.config
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/VB/GridControlCRUDSimple/Application.xaml b/VB/GridControlCRUDSimple/Application.xaml
new file mode 100644
index 0000000..7812804
--- /dev/null
+++ b/VB/GridControlCRUDSimple/Application.xaml
@@ -0,0 +1,9 @@
+
+
+
+
+
diff --git a/VB/GridControlCRUDSimple/Application.xaml.vb b/VB/GridControlCRUDSimple/Application.xaml.vb
new file mode 100644
index 0000000..8d7f138
--- /dev/null
+++ b/VB/GridControlCRUDSimple/Application.xaml.vb
@@ -0,0 +1,13 @@
+Imports DevExpress.Xpf.Core
+Imports System.Windows
+
+Namespace GridControlCRUDSimple
+ Partial Public Class App
+ Inherits Application
+
+ Public Sub New()
+ ApplicationThemeHelper.UpdateApplicationThemeName()
+ DevExpress.Internal.DbEngineDetector.PatchConnectionStringsAndConfigureEntityFrameworkDefaultConnectionFactory()
+ End Sub
+ End Class
+End Namespace
diff --git a/VB/GridControlCRUDSimple/GridControlCRUDSimple.sln b/VB/GridControlCRUDSimple/GridControlCRUDSimple.sln
new file mode 100644
index 0000000..43b7e16
--- /dev/null
+++ b/VB/GridControlCRUDSimple/GridControlCRUDSimple.sln
@@ -0,0 +1,24 @@
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.29806.167
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "GridControlCRUDSimple", "GridControlCRUDSimple.vbproj", "{9E2883B9-744A-48BF-B25A-EA4B2D435C9D}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {9E2883B9-744A-48BF-B25A-EA4B2D435C9D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {9E2883B9-744A-48BF-B25A-EA4B2D435C9D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {9E2883B9-744A-48BF-B25A-EA4B2D435C9D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {9E2883B9-744A-48BF-B25A-EA4B2D435C9D}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {51597E69-ADA1-4945-9493-FC7C9FB65AD2}
+ EndGlobalSection
+EndGlobal
diff --git a/VB/GridControlCRUDSimple/GridControlCRUDSimple.vbproj b/VB/GridControlCRUDSimple/GridControlCRUDSimple.vbproj
new file mode 100644
index 0000000..12eab10
--- /dev/null
+++ b/VB/GridControlCRUDSimple/GridControlCRUDSimple.vbproj
@@ -0,0 +1,198 @@
+
+
+
+
+
+ Debug
+ AnyCPU
+ {9E2883B9-744A-48BF-B25A-EA4B2D435C9D}
+ WinExe
+
+ GridControlCRUDSimple
+ v4.5.2
+ 512
+ {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{F184B08F-C81C-45F6-A57F-5ABD9991F28F}
+ true
+ true
+
+ On
+ Binary
+ Off
+ On
+
+
+ AnyCPU
+ true
+ full
+ false
+ bin\Debug\
+ true
+ true
+ prompt
+ true
+
+
+ AnyCPU
+ pdbonly
+ true
+ bin\Release\
+ false
+ true
+ prompt
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ True
+ E:\DXDLLS\20.1.4\DevExpress.Data.v20.1.dll
+
+
+ True
+ E:\DXDLLS\20.1.4\DevExpress.Data.Desktop.v20.1.dll
+
+
+ True
+ E:\DXDLLS\20.1.4\DevExpress.Mvvm.v20.1.dll
+
+
+ True
+ E:\DXDLLS\20.1.4\DevExpress.Printing.v20.1.Core.dll
+
+
+ True
+ E:\DXDLLS\20.1.4\DevExpress.Xpf.Core.v20.1.dll
+
+
+ True
+ E:\DXDLLS\20.1.4\DevExpress.Xpf.Printing.v20.1.dll
+
+
+ True
+ E:\DXDLLS\20.1.4\DevExpress.Xpf.Grid.v20.1.dll
+
+
+ True
+ E:\DXDLLS\20.1.4\DevExpress.Xpf.Grid.v20.1.Core.dll
+
+
+ True
+ E:\DXDLLS\20.1.4\DevExpress.Xpf.Grid.v20.1.Extensions.dll
+
+
+ ..\packages\EntityFramework.6.4.0\lib\net45\EntityFramework.dll
+
+
+ ..\packages\EntityFramework.6.4.0\lib\net45\EntityFramework.SqlServer.dll
+
+
+
+
+
+
+
+
+
+
+
+ 4.0
+
+
+
+
+
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ Northwind.DataModel\CategoryInfo.vb
+
+
+ Northwind.DataModel\ProductInfo.vb
+
+
+ Northwind\Category.vb
+
+
+ Northwind\NorthwindContext.vb
+
+
+ Northwind\NorthwindContextInitializer.vb
+
+
+ Northwind\Product.vb
+
+
+ Application.xaml
+ Code
+
+
+ MainWindow.xaml
+ Code
+
+
+
+
+ Code
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ Settings.settings
+ True
+
+
+ VbMyResourcesResXFileCodeGenerator
+ Resources.Designer.vb
+ My.Resources
+
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.vb
+ My
+
+
+
+
+
+
+
+
+
+ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
+
+
+
+
+
+
\ No newline at end of file
diff --git a/VB/GridControlCRUDSimple/MainWindow.xaml b/VB/GridControlCRUDSimple/MainWindow.xaml
new file mode 100644
index 0000000..f7b8f40
--- /dev/null
+++ b/VB/GridControlCRUDSimple/MainWindow.xaml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/VB/GridControlCRUDSimple/MainWindow.xaml.vb b/VB/GridControlCRUDSimple/MainWindow.xaml.vb
new file mode 100644
index 0000000..63fc738
--- /dev/null
+++ b/VB/GridControlCRUDSimple/MainWindow.xaml.vb
@@ -0,0 +1,73 @@
+Imports DevExpress.Xpf.Core
+Imports DevExpress.Xpf.Grid
+Imports DevExpress.CRUD.Northwind
+Imports DevExpress.CRUD.Northwind.DataModel
+Imports System
+Imports System.Linq
+Imports System.Windows
+Imports System.Windows.Input
+
+Namespace GridControlCRUDSimple
+ Partial Public Class MainWindow
+ Inherits ThemedWindow
+
+ Public Sub New()
+ InitializeComponent()
+ Using context = New NorthwindContext()
+ grid.ItemsSource = context.Products.Select(Function(product) New ProductInfo With {
+ .Id = product.Id,
+ .Name = product.Name,
+ .CategoryId = product.CategoryId
+ }).ToList()
+ categoriesLookup.ItemsSource = context.Categories.Select(Function(category) New CategoryInfo With {
+ .Id = category.Id,
+ .Name = category.Name
+ }).ToList()
+ End Using
+ End Sub
+
+ Private Sub tableView_ValidateRow(ByVal sender As Object, ByVal e As GridRowValidationEventArgs)
+ Dim productInfo As ProductInfo = CType(e.Row, ProductInfo)
+ Using context = New NorthwindContext()
+ Dim result As Product
+ If view.FocusedRowHandle = GridControl.NewItemRowHandle Then
+ result = New Product()
+ context.Products.Add(result)
+ Else
+ result = context.Products.SingleOrDefault(Function(product) product.Id = productInfo.Id)
+ If result Is Nothing Then
+ Throw New NotImplementedException("The modified row does not exist in a database anymore. Handle this case according to your requirements.")
+ End If
+ End If
+ result.Name = productInfo.Name
+ result.CategoryId = productInfo.CategoryId
+ context.SaveChanges()
+ End Using
+ End Sub
+
+ Private Sub grid_KeyDown(ByVal sender As Object, ByVal e As KeyEventArgs)
+ If e.Key = Key.Delete Then
+ Dim productInfo As ProductInfo = CType(grid.SelectedItem, ProductInfo)
+ If productInfo Is Nothing Then
+ Return
+ End If
+ If DXMessageBox.Show(Me, "Are you sure you want to delete this row?", "Delete Row", MessageBoxButton.OKCancel) = MessageBoxResult.Cancel Then
+ Return
+ End If
+ Try
+ Using context = New NorthwindContext()
+ Dim result = context.Products.Find(productInfo.Id)
+ If result Is Nothing Then
+ Throw New NotImplementedException("The deleted row does not exist in a database anymore. Handle this case according to your requirements.")
+ End If
+ context.Products.Remove(result)
+ context.SaveChanges()
+ view.Commands.DeleteFocusedRow.Execute(Nothing)
+ End Using
+ Catch ex As Exception
+ DXMessageBox.Show(ex.Message)
+ End Try
+ End If
+ End Sub
+ End Class
+End Namespace
diff --git a/VB/GridControlCRUDSimple/My Project/AssemblyInfo.vb b/VB/GridControlCRUDSimple/My Project/AssemblyInfo.vb
new file mode 100644
index 0000000..2df644f
--- /dev/null
+++ b/VB/GridControlCRUDSimple/My Project/AssemblyInfo.vb
@@ -0,0 +1,48 @@
+Imports System.Reflection
+Imports System.Resources
+Imports System.Runtime.CompilerServices
+Imports System.Runtime.InteropServices
+Imports System.Windows
+
+' General Information about an assembly is controlled through the following
+' set of attributes. Change these attribute values to modify the information
+' associated with an assembly.
+
+
+
+
+
+
+
+
+
+' Setting ComVisible to false makes the types in this assembly not visible
+' to COM components. If you need to access a type in this assembly from
+' COM, set the ComVisible attribute to true on that type.
+
+
+'In order to begin building localizable applications, set
+'CultureYouAreCodingWith in your .csproj file
+'inside a . For example, if you are using US english
+'in your source files, set the to en-US. Then uncomment
+'the NeutralResourceLanguage attribute below. Update the "en-US" in
+'the line below to match the UICulture setting in the project file.
+
+'[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
+
+
+
+
+
+' Version information for an assembly consists of the following four values:
+'
+' Major Version
+' Minor Version
+' Build Number
+' Revision
+'
+' You can specify all the values or you can default the Build and Revision Numbers
+' by using the '*' as shown below:
+' [assembly: AssemblyVersion("1.0.*")]
+
+
diff --git a/VB/GridControlCRUDSimple/My Project/Resources.Designer.vb b/VB/GridControlCRUDSimple/My Project/Resources.Designer.vb
new file mode 100644
index 0000000..5b98c08
--- /dev/null
+++ b/VB/GridControlCRUDSimple/My Project/Resources.Designer.vb
@@ -0,0 +1,63 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:4.0.30319.42000
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Namespace My.Resources
+
+
+ '''
+ ''' A strongly-typed resource class, for looking up localized strings, etc.
+ '''
+ ' This class was auto-generated by the StronglyTypedResourceBuilder
+ ' class via a tool like ResGen or Visual Studio.
+ ' To add or remove a member, edit your .ResX file then rerun ResGen
+ ' with the /str option, or rebuild your VS project.
+
+
+
+ Friend Module Resources
+
+ Private resourceMan As Global.System.Resources.ResourceManager
+
+ Private resourceCulture As Global.System.Globalization.CultureInfo
+
+' internal Resources()
+' {
+' }
+
+ '''
+ ''' Returns the cached ResourceManager instance used by this class.
+ '''
+
+ Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
+ Get
+ If (resourceMan Is Nothing) Then
+ Dim temp As New Global.System.Resources.ResourceManager("Resources", GetType(Resources).Assembly)
+ resourceMan = temp
+ End If
+ Return resourceMan
+ End Get
+ End Property
+
+ '''
+ ''' Overrides the current thread's CurrentUICulture property for all
+ ''' resource lookups using this strongly typed resource class.
+ '''
+
+ Friend Property Culture() As Global.System.Globalization.CultureInfo
+ Get
+ Return resourceCulture
+ End Get
+ Set(ByVal value As System.Globalization.CultureInfo)
+ resourceCulture = value
+ End Set
+ End Property
+ End Module
+End Namespace
diff --git a/VB/GridControlCRUDSimple/My Project/Resources.resx b/VB/GridControlCRUDSimple/My Project/Resources.resx
new file mode 100644
index 0000000..af7dbeb
--- /dev/null
+++ b/VB/GridControlCRUDSimple/My Project/Resources.resx
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/VB/GridControlCRUDSimple/My Project/Settings.Designer.vb b/VB/GridControlCRUDSimple/My Project/Settings.Designer.vb
new file mode 100644
index 0000000..bdf1141
--- /dev/null
+++ b/VB/GridControlCRUDSimple/My Project/Settings.Designer.vb
@@ -0,0 +1,27 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:4.0.30319.42000
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Namespace My
+
+
+
+
+ Friend NotInheritable Partial Class Settings
+ Inherits System.Configuration.ApplicationSettingsBase
+
+ Private Shared defaultInstance As Settings = (CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New Settings()), Settings))
+
+ Public Shared ReadOnly Property [Default]() As Settings
+ Get
+ Return defaultInstance
+ End Get
+ End Property
+ End Class
+End Namespace
diff --git a/VB/GridControlCRUDSimple/My Project/Settings.settings b/VB/GridControlCRUDSimple/My Project/Settings.settings
new file mode 100644
index 0000000..033d7a5
--- /dev/null
+++ b/VB/GridControlCRUDSimple/My Project/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/VB/GridControlCRUDSimple/packages.config b/VB/GridControlCRUDSimple/packages.config
new file mode 100644
index 0000000..9985587
--- /dev/null
+++ b/VB/GridControlCRUDSimple/packages.config
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/VB/NuGet.Config b/VB/NuGet.Config
new file mode 100644
index 0000000..6e4014d
--- /dev/null
+++ b/VB/NuGet.Config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/VB/Shared/Common.DataModel - VB/DesignTimeDataProvider.vb b/VB/Shared/Common.DataModel - VB/DesignTimeDataProvider.vb
new file mode 100644
index 0000000..cb5c938
--- /dev/null
+++ b/VB/Shared/Common.DataModel - VB/DesignTimeDataProvider.vb
@@ -0,0 +1,30 @@
+Imports System
+Imports System.Collections.Generic
+Imports System.Linq
+
+Namespace DevExpress.CRUD.DataModel
+ Public Class DesignTimeDataProvider(Of T As Class)
+ Implements ICRUDDataProvider(Of T)
+
+ Private ReadOnly createEntity As Func(Of Integer, T)
+ Private ReadOnly count As Integer
+
+ Public Sub New(ByVal createEntity As Func(Of Integer, T), Optional ByVal count As Integer = 5)
+ Me.createEntity = createEntity
+ Me.count = count
+ End Sub
+
+ Private Function IDataProviderGeneric_Read() As IList(Of T) Implements IDataProvider(Of T).Read
+ Return Enumerable.Range(0, count).Select(createEntity).ToList()
+ End Function
+ Private Sub ICRUDDataProviderGeneric_Create(ByVal obj As T) Implements ICRUDDataProvider(Of T).Create
+ Throw New NotSupportedException()
+ End Sub
+ Private Sub ICRUDDataProviderGeneric_Delete(ByVal obj As T) Implements ICRUDDataProvider(Of T).Delete
+ Throw New NotSupportedException()
+ End Sub
+ Private Sub ICRUDDataProviderGeneric_Update(ByVal obj As T) Implements ICRUDDataProvider(Of T).Update
+ Throw New NotSupportedException()
+ End Sub
+ End Class
+End Namespace
diff --git a/VB/Shared/Common.DataModel - VB/ICRUDDataProvider.vb b/VB/Shared/Common.DataModel - VB/ICRUDDataProvider.vb
new file mode 100644
index 0000000..e3fa0a5
--- /dev/null
+++ b/VB/Shared/Common.DataModel - VB/ICRUDDataProvider.vb
@@ -0,0 +1,12 @@
+Imports System
+Imports System.Linq
+
+Namespace DevExpress.CRUD.DataModel
+ Public Interface ICRUDDataProvider(Of T As Class)
+ Inherits IDataProvider(Of T)
+
+ Sub Create(ByVal obj As T)
+ Sub Update(ByVal obj As T)
+ Sub Delete(ByVal obj As T)
+ End Interface
+End Namespace
diff --git a/VB/Shared/Common.DataModel - VB/IDataProvider.vb b/VB/Shared/Common.DataModel - VB/IDataProvider.vb
new file mode 100644
index 0000000..d418cec
--- /dev/null
+++ b/VB/Shared/Common.DataModel - VB/IDataProvider.vb
@@ -0,0 +1,9 @@
+Imports System
+Imports System.Collections.Generic
+Imports System.Linq
+
+Namespace DevExpress.CRUD.DataModel
+ Public Interface IDataProvider(Of T As Class)
+ Function Read() As IList(Of T)
+ End Interface
+End Namespace
diff --git a/VB/Shared/Common.DataModel.EntityFramework - VB/EntityFrameworkCRUDDataProvider.vb b/VB/Shared/Common.DataModel.EntityFramework - VB/EntityFrameworkCRUDDataProvider.vb
new file mode 100644
index 0000000..ec18d94
--- /dev/null
+++ b/VB/Shared/Common.DataModel.EntityFramework - VB/EntityFrameworkCRUDDataProvider.vb
@@ -0,0 +1,93 @@
+Imports System
+Imports System.Data.Entity
+Imports System.Data.Entity.Infrastructure
+Imports System.Data.Entity.Validation
+Imports System.Linq
+Imports System.Linq.Expressions
+Imports System.Text
+
+Namespace DevExpress.CRUD.DataModel.EntityFramework
+ Public Class EntityFrameworkCRUDDataProvider(Of TContext As DbContext, TEntity As Class, T As Class, TKey)
+ Inherits EntityFrameworkDataProvider(Of TContext, TEntity, T)
+ Implements ICRUDDataProvider(Of T)
+
+ Private ReadOnly getKey As Func(Of T, TKey)
+ Private ReadOnly getEntityKey As Func(Of TEntity, TKey)
+ Private ReadOnly setKey As Action(Of T, TKey)
+ Private ReadOnly applyProperties As Action(Of T, TEntity)
+
+ Public Sub New(ByVal createContext As Func(Of TContext), ByVal getDbSet As Func(Of TContext, DbSet(Of TEntity)), ByVal getEnityExpression As Expression(Of Func(Of TEntity, T)), ByVal getKey As Func(Of T, TKey), ByVal getEntityKey As Func(Of TEntity, TKey), ByVal setKey As Action(Of T, TKey), ByVal applyProperties As Action(Of T, TEntity))
+ MyBase.New(createContext, getDbSet, getEnityExpression)
+ Me.getKey = getKey
+ Me.getEntityKey = getEntityKey
+ Me.setKey = setKey
+ Me.applyProperties = applyProperties
+ End Sub
+
+ Private Sub ICRUDDataProviderGeneric_Delete(ByVal obj As T) Implements ICRUDDataProvider(Of T).Delete
+ Using context = createContext()
+ Dim entity = getDbSet(context).Find(getKey(obj))
+ If entity Is Nothing Then
+ Throw New NotImplementedException("The deleted row does not exist in a database anymore. Handle this case according to your requirements.")
+ End If
+ getDbSet(context).Remove(entity)
+ SaveChanges(context)
+ End Using
+ End Sub
+
+ Private Sub ICRUDDataProviderGeneric_Create(ByVal obj As T) Implements ICRUDDataProvider(Of T).Create
+ Using context = createContext()
+ Dim entity = getDbSet(context).Create()
+ getDbSet(context).Add(entity)
+ applyProperties(obj, entity)
+ SaveChanges(context)
+ setKey(obj, getEntityKey(entity))
+ End Using
+ End Sub
+
+ Private Sub ICRUDDataProviderGeneric_Update(ByVal obj As T) Implements ICRUDDataProvider(Of T).Update
+ Using context = createContext()
+ Dim entity = getDbSet(context).Find(getKey(obj))
+ If entity Is Nothing Then
+ Throw New NotImplementedException("The modified row does not exist in a database anymore. Handle this case according to your requirements.")
+ End If
+ applyProperties(obj, entity)
+ SaveChanges(context)
+ End Using
+ End Sub
+
+ Private Shared Sub SaveChanges(ByVal context As TContext)
+ Try
+ context.SaveChanges()
+ Catch e As Exception
+ Throw ConvertException(e)
+ End Try
+ End Sub
+
+ Private Shared Function ConvertException(ByVal e As Exception) As DbException
+ Dim entityValidationException = TryCast(e, DbEntityValidationException)
+ If entityValidationException IsNot Nothing Then
+ Dim stringBuilder As New StringBuilder()
+ For Each validationResult In entityValidationException.EntityValidationErrors
+ For Each [error] In validationResult.ValidationErrors
+ If stringBuilder.Length > 0 Then
+ stringBuilder.AppendLine()
+ End If
+ stringBuilder.Append([error].PropertyName & ": " & [error].ErrorMessage)
+ Next [error]
+ Next validationResult
+ Return New DbException(stringBuilder.ToString(), entityValidationException)
+ End If
+ Return New DbException("An error has occurred while updating the database.", entityValidationException)
+ End Function
+ End Class
+ Public Class DbException
+ Inherits Exception
+
+'INSTANT VB NOTE: The variable message was renamed since Visual Basic does not handle local variables named the same as class members well:
+'INSTANT VB NOTE: The variable innerException was renamed since Visual Basic does not handle local variables named the same as class members well:
+ Public Sub New(ByVal message_Conflict As String, ByVal innerException_Conflict As Exception)
+ MyBase.New(message_Conflict, innerException_Conflict)
+ End Sub
+ End Class
+End Namespace
diff --git a/VB/Shared/Common.DataModel.EntityFramework - VB/EntityFrameworkDataProvider.vb b/VB/Shared/Common.DataModel.EntityFramework - VB/EntityFrameworkDataProvider.vb
new file mode 100644
index 0000000..ce5ef39
--- /dev/null
+++ b/VB/Shared/Common.DataModel.EntityFramework - VB/EntityFrameworkDataProvider.vb
@@ -0,0 +1,28 @@
+Imports System
+Imports System.Collections.Generic
+Imports System.Data.Entity
+Imports System.Linq
+Imports System.Linq.Expressions
+
+Namespace DevExpress.CRUD.DataModel.EntityFramework
+ Public Class EntityFrameworkDataProvider(Of TContext As DbContext, TEntity As Class, T As Class)
+ Implements IDataProvider(Of T)
+
+ Protected ReadOnly createContext As Func(Of TContext)
+ Protected ReadOnly getDbSet As Func(Of TContext, DbSet(Of TEntity))
+ Private ReadOnly getEntityExpression As Expression(Of Func(Of TEntity, T))
+
+ Public Sub New(ByVal createContext As Func(Of TContext), ByVal getDbSet As Func(Of TContext, DbSet(Of TEntity)), ByVal getEnityExpression As Expression(Of Func(Of TEntity, T)))
+ Me.createContext = createContext
+ Me.getDbSet = getDbSet
+ Me.getEntityExpression = getEnityExpression
+ End Sub
+
+ Private Function IDataProviderGeneric_Read() As IList(Of T) Implements IDataProvider(Of T).Read
+ Using context = createContext()
+ Dim query = getDbSet(context).Select(getEntityExpression)
+ Return query.ToList()
+ End Using
+ End Function
+ End Class
+End Namespace
diff --git a/VB/Shared/Northwind - VB/Category.vb b/VB/Shared/Northwind - VB/Category.vb
new file mode 100644
index 0000000..206d13a
--- /dev/null
+++ b/VB/Shared/Northwind - VB/Category.vb
@@ -0,0 +1,12 @@
+Imports System
+Imports System.Collections.Generic
+Imports System.Linq
+
+Namespace DevExpress.CRUD.Northwind
+ Public Class Category
+ Public Property Id() As Long
+ Public Property Name() As String
+ Public Property Description() As String
+ Public Overridable Property Products() As ICollection(Of Product)
+ End Class
+End Namespace
diff --git a/VB/Shared/Northwind - VB/NorthwindContext.vb b/VB/Shared/Northwind - VB/NorthwindContext.vb
new file mode 100644
index 0000000..797f794
--- /dev/null
+++ b/VB/Shared/Northwind - VB/NorthwindContext.vb
@@ -0,0 +1,21 @@
+Imports System
+Imports System.Collections.Generic
+Imports System.Data.Entity
+Imports System.Linq
+Imports System.Text
+Imports System.Threading.Tasks
+
+Namespace DevExpress.CRUD.Northwind
+ Public Class NorthwindContext
+ Inherits DbContext
+
+ Shared Sub New()
+ Database.SetInitializer(New NorthwindContextInitializer())
+ End Sub
+ Protected Overrides Sub OnModelCreating(ByVal modelBuilder As DbModelBuilder)
+ modelBuilder.Entity(Of Product)().Property(Function(x) x.Name).IsRequired()
+ End Sub
+ Public Property Categories() As DbSet(Of Category)
+ Public Property Products() As DbSet(Of Product)
+ End Class
+End Namespace
diff --git a/VB/Shared/Northwind - VB/NorthwindContextInitializer.vb b/VB/Shared/Northwind - VB/NorthwindContextInitializer.vb
new file mode 100644
index 0000000..4b6ff3f
--- /dev/null
+++ b/VB/Shared/Northwind - VB/NorthwindContextInitializer.vb
@@ -0,0 +1,97 @@
+Imports System.Collections.Generic
+Imports System.Data.Entity
+
+Namespace DevExpress.CRUD.Northwind
+ Public Class NorthwindContextInitializer
+ Inherits DropCreateDatabaseIfModelChanges(Of NorthwindContext)
+
+ Protected Overrides Sub Seed(ByVal context As NorthwindContext)
+ MyBase.Seed(context)
+
+ Dim categories = New List(Of Category) _
+ From {
+ New Category With {
+ .Name = "Beverages",
+ .Description = "Soft drinks, coffees, teas, beers, and ales",
+ .Products = New List(Of Product) From {
+ New Product With {
+ .Name = "Chai",
+ .QuantityPerUnit = "10 boxes x 20 bags",
+ .UnitPrice = CDec(18),
+ .UnitsInStock = 39,
+ .UnitsOnOrder = 0,
+ .ReorderLevel = 10,
+ .Discontinued = False,
+ .EAN13 = "070684900001"
+ },
+ New Product With {
+ .Name = "Ipoh Coffee",
+ .QuantityPerUnit = "16 - 500 g tins",
+ .UnitPrice = CDec(46),
+ .UnitsInStock = 17,
+ .UnitsOnOrder = 10,
+ .ReorderLevel = 25,
+ .Discontinued = False,
+ .EAN13 = "070684900043"
+ }
+ }
+ },
+ New Category With {
+ .Name = "Condiments",
+ .Description = "Sweet and savory sauces, relishes, spreads, and seasonings",
+ .Products = New List(Of Product) From {
+ New Product With {
+ .Name = "Aniseed Syrup",
+ .QuantityPerUnit = "12 - 550 ml bottles",
+ .UnitPrice = CDec(10),
+ .UnitsInStock = 13,
+ .UnitsOnOrder = 70,
+ .ReorderLevel = 25,
+ .Discontinued = False,
+ .EAN13 = "070684900003"
+ },
+ New Product With {
+ .Name = "Louisiana Fiery Hot Pepper Sauce",
+ .QuantityPerUnit = "32 - 8 oz bottles",
+ .UnitPrice = CDec(21.05),
+ .UnitsInStock = 76,
+ .UnitsOnOrder = 0,
+ .ReorderLevel = 0,
+ .Discontinued = False,
+ .EAN13 = "070684900065"
+ }
+ }
+ },
+ New Category With {
+ .Name = "Grains/Cereals",
+ .Description = "Breads, crackers, pasta, and cereal",
+ .Products = New List(Of Product) From {
+ New Product With {
+ .Name = "Singaporean Hokkien Fried Mee",
+ .QuantityPerUnit = "32 - 1 kg pkgs.",
+ .UnitPrice = CDec(14),
+ .UnitsInStock = 26,
+ .UnitsOnOrder = 0,
+ .ReorderLevel = 0,
+ .Discontinued = True,
+ .EAN13 = "070684900042"
+ },
+ New Product With {
+ .Name = "Ravioli Angelo",
+ .QuantityPerUnit = "24 - 250 g pkgs.",
+ .UnitPrice = CDec(19.5),
+ .UnitsInStock = 36,
+ .UnitsOnOrder = 0,
+ .ReorderLevel = 20,
+ .Discontinued = False,
+ .EAN13 = "070684900057"
+ }
+ }
+ }
+ }
+
+ context.Categories.AddRange(categories)
+ context.SaveChanges()
+ End Sub
+ End Class
+End Namespace
diff --git a/VB/Shared/Northwind - VB/Product.vb b/VB/Shared/Northwind - VB/Product.vb
new file mode 100644
index 0000000..422f001
--- /dev/null
+++ b/VB/Shared/Northwind - VB/Product.vb
@@ -0,0 +1,18 @@
+Imports System
+Imports System.Linq
+
+Namespace DevExpress.CRUD.Northwind
+ Public Class Product
+ Public Property Id() As Long
+ Public Property Name() As String
+ Public Property CategoryId() As Long
+ Public Overridable Property Category() As Category
+ Public Property QuantityPerUnit() As String
+ Public Property UnitPrice() As Decimal?
+ Public Property UnitsInStock() As Short?
+ Public Property UnitsOnOrder() As Short?
+ Public Property ReorderLevel() As Short?
+ Public Property Discontinued() As Boolean
+ Public Property EAN13() As String
+ End Class
+End Namespace
diff --git a/VB/Shared/Northwind.DataModel - VB/CategoryInfo.vb b/VB/Shared/Northwind.DataModel - VB/CategoryInfo.vb
new file mode 100644
index 0000000..5def298
--- /dev/null
+++ b/VB/Shared/Northwind.DataModel - VB/CategoryInfo.vb
@@ -0,0 +1,9 @@
+Imports System
+Imports System.Linq
+
+Namespace DevExpress.CRUD.Northwind.DataModel
+ Public Class CategoryInfo
+ Public Property Name() As String
+ Public Property Id() As Long
+ End Class
+End Namespace
diff --git a/VB/Shared/Northwind.DataModel - VB/NorthwindDataStorage.vb b/VB/Shared/Northwind.DataModel - VB/NorthwindDataStorage.vb
new file mode 100644
index 0000000..16dda0d
--- /dev/null
+++ b/VB/Shared/Northwind.DataModel - VB/NorthwindDataStorage.vb
@@ -0,0 +1,14 @@
+Imports DevExpress.CRUD.DataModel
+
+Namespace DevExpress.CRUD.Northwind.DataModel
+ Public Class NorthwindDataStorage
+'INSTANT VB NOTE: The variable categories was renamed since Visual Basic does not handle local variables named the same as class members well:
+'INSTANT VB NOTE: The variable products was renamed since Visual Basic does not handle local variables named the same as class members well:
+ Public Sub New(ByVal categories_Conflict As IDataProvider(Of CategoryInfo), ByVal products_Conflict As ICRUDDataProvider(Of ProductInfo))
+ Me.Categories = categories_Conflict
+ Me.Products = products_Conflict
+ End Sub
+ Public ReadOnly Property Categories() As IDataProvider(Of CategoryInfo)
+ Public ReadOnly Property Products() As ICRUDDataProvider(Of ProductInfo)
+ End Class
+End Namespace
diff --git a/VB/Shared/Northwind.DataModel - VB/NorthwindDataStorageFactory.vb b/VB/Shared/Northwind.DataModel - VB/NorthwindDataStorageFactory.vb
new file mode 100644
index 0000000..4c006fa
--- /dev/null
+++ b/VB/Shared/Northwind.DataModel - VB/NorthwindDataStorageFactory.vb
@@ -0,0 +1,30 @@
+Imports DevExpress.CRUD.DataModel.EntityFramework
+Imports DevExpress.CRUD.DataModel
+
+Namespace DevExpress.CRUD.Northwind.DataModel
+ Public Module NorthwindDataStorageFactory
+ Public Function Create(ByVal isInDesignMode As Boolean) As NorthwindDataStorage
+ If isInDesignMode Then
+ Return New NorthwindDataStorage(New DesignTimeDataProvider(Of CategoryInfo)(Function(id) New CategoryInfo With {
+ .Id = id,
+ .Name = "Category " & id
+ }), New DesignTimeDataProvider(Of ProductInfo)(Function(id) New ProductInfo With {
+ .Id = id,
+ .Name = "Product " & id,
+ .CategoryId = id
+ }))
+ End If
+ Return New NorthwindDataStorage(New EntityFrameworkDataProvider(Of NorthwindContext, Category, CategoryInfo)(createContext:= Function() New NorthwindContext(), getDbSet:= Function(context) context.Categories, getEnityExpression:= Function(category) New CategoryInfo With {
+ .Id = category.Id,
+ .Name = category.Name
+ }), New EntityFrameworkCRUDDataProvider(Of NorthwindContext, Product, ProductInfo, Long)(createContext:= Function() New NorthwindContext(), getDbSet:= Function(context) context.Products, getEnityExpression:= Function(product) New ProductInfo With {
+ .Id = product.Id,
+ .Name = product.Name,
+ .CategoryId = product.CategoryId
+ }, getKey:= Function(productInfo) productInfo.Id, getEntityKey:= Function(product) product.Id, setKey:= Sub(productInfo, id) productInfo.Id = id, applyProperties:= Sub(productInfo, product)
+ product.Name = productInfo.Name
+ product.CategoryId = productInfo.CategoryId
+ End Sub))
+ End Function
+ End Module
+End Namespace
diff --git a/VB/Shared/Northwind.DataModel - VB/ProductInfo.vb b/VB/Shared/Northwind.DataModel - VB/ProductInfo.vb
new file mode 100644
index 0000000..c035e53
--- /dev/null
+++ b/VB/Shared/Northwind.DataModel - VB/ProductInfo.vb
@@ -0,0 +1,10 @@
+Imports System
+Imports System.Linq
+
+Namespace DevExpress.CRUD.Northwind.DataModel
+ Public Class ProductInfo
+ Public Property Name() As String
+ Public Property Id() As Long
+ Public Property CategoryId() As Long
+ End Class
+End Namespace