xavehoo
/
XAF_how-to-prevent-altering-the-legacy-database-schema-when-creating-an-xaf-application-e1150
Public
forked from DevExpress-Examples/xaf-how-to-prevent-altering-the-legacy-database-schema-when-creating-an-xaf-application
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModule.vb
More file actions
33 lines (31 loc) · 1.65 KB
/
Module.vb
File metadata and controls
33 lines (31 loc) · 1.65 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
Imports System
Imports System.Collections.Generic
Imports DevExpress.ExpressApp
Imports System.Reflection
Imports DevExpress.ExpressApp.Xpo
Imports System.Configuration
Namespace WinWebSolution.Module
Public NotInheritable Partial Class WinWebSolutionModule
Inherits ModuleBase
Private Shared provider As XpoDataStoreProxyProvider
Public Sub New()
InitializeComponent()
End Sub
Public Overrides Sub Setup(ByVal application As XafApplication)
MyBase.Setup(application)
AddHandler application.CustomCheckCompatibility, AddressOf application_CustomCheckCompatibility
AddHandler application.CreateCustomObjectSpaceProvider, AddressOf application_CreateCustomObjectSpaceProvider
End Sub
Private Sub application_CreateCustomObjectSpaceProvider(ByVal sender As Object, ByVal e As CreateCustomObjectSpaceProviderEventArgs)
If provider Is Nothing Then
provider = New XpoDataStoreProxyProvider()
End If
e.ObjectSpaceProvider = New XPObjectSpaceProvider(provider)
End Sub
Private Sub application_CustomCheckCompatibility(ByVal sender As Object, ByVal e As CustomCheckCompatibilityEventArgs)
If provider IsNot Nothing AndAlso (Not provider.IsInitialized) Then
provider.Initialize(CType(e.ObjectSpaceProvider, XPObjectSpaceProvider).XPDictionary, ConfigurationManager.ConnectionStrings("LegacyDatabaseConnectionString").ConnectionString, ConfigurationManager.ConnectionStrings("TempDatabaseConnectionString").ConnectionString)
End If
End Sub
End Class
End Namespace