-
Notifications
You must be signed in to change notification settings - Fork 80
/
Global.asax.vb
29 lines (26 loc) · 1.01 KB
/
Global.asax.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
Imports System.Configuration
Imports System.Web.Optimization
Imports System.Web.Routing
Imports DevExpress.ExpressApp.Xpo
Imports DatabaseUpdater
Namespace WebFormsApplication
Public Class [Global]
Inherits HttpApplication
Private Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs on application startup
RouteConfig.RegisterRoutes(RouteTable.Routes)
BundleConfig.RegisterBundles(BundleTable.Bundles)
Dim connectionString As String = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString
CreateDemoData(connectionString)
End Sub
Private Shared Sub CreateDemoData(ByVal connectionString As String)
Using objectSpaceProvider = New XPObjectSpaceProvider(connectionString)
ConnectionHelper.RegisterEntities(objectSpaceProvider)
Using objectSpace = objectSpaceProvider.CreateUpdatingObjectSpace(True)
Dim updater As Updater = New Updater(objectSpace)
updater.UpdateDatabase()
End Using
End Using
End Sub
End Class
End Namespace