This repository has been archived by the owner on Oct 16, 2023. It is now read-only.
/
WebApplication.cs
66 lines (62 loc) · 3.82 KB
/
WebApplication.cs
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
using System;
using DevExpress.ExpressApp;
using System.ComponentModel;
using DevExpress.ExpressApp.Web;
using System.Collections.Generic;
using DevExpress.ExpressApp.Xpo;
namespace DelayedImagesXPO.Web {
// For more typical usage scenarios, be sure to check out http://documentation.devexpress.com/#Xaf/DevExpressExpressAppWebWebApplicationMembersTopicAll
public partial class DelayedImagesXPOAspNetApplication : WebApplication {
private DevExpress.ExpressApp.SystemModule.SystemModule module1;
private DevExpress.ExpressApp.Web.SystemModule.SystemAspNetModule module2;
private DelayedImagesXPO.Module.DelayedImagesXPOModule module3;
public DelayedImagesXPOAspNetApplication() {
InitializeComponent();
}
protected override void CreateDefaultObjectSpaceProvider(CreateCustomObjectSpaceProviderEventArgs args) {
args.ObjectSpaceProvider = new XPObjectSpaceProvider(args.ConnectionString, args.Connection);
}
private void DelayedImagesXPOAspNetApplication_DatabaseVersionMismatch(object sender, DevExpress.ExpressApp.DatabaseVersionMismatchEventArgs e) {
#if EASYTEST
e.Updater.Update();
e.Handled = true;
#else
if(System.Diagnostics.Debugger.IsAttached) {
e.Updater.Update();
e.Handled = true;
}
else {
string message = "The application cannot connect to the specified database, because the latter doesn't exist or its version is older than that of the application.\r\n" +
"This error occurred because the automatic database update was disabled when the application was started without debugging.\r\n" +
"To avoid this error, you should either start the application under Visual Studio in debug mode, or modify the " +
"source code of the 'DatabaseVersionMismatch' event handler to enable automatic database update, " +
"or manually create a database using the 'DBUpdater' tool.\r\n" +
"Anyway, refer to the following help topics for more detailed information:\r\n" +
"'Update Application and Database Versions' at http://www.devexpress.com/Help/?document=ExpressApp/CustomDocument2795.htm\r\n" +
"'Database Security References' at http://www.devexpress.com/Help/?document=ExpressApp/CustomDocument3237.htm\r\n" +
"If this doesn't help, please contact our Support Team at http://www.devexpress.com/Support/Center/";
if(e.CompatibilityError != null && e.CompatibilityError.Exception != null) {
message += "\r\n\r\nInner exception: " + e.CompatibilityError.Exception.Message;
}
throw new InvalidOperationException(message);
}
#endif
}
private void InitializeComponent() {
this.module1 = new DevExpress.ExpressApp.SystemModule.SystemModule();
this.module2 = new DevExpress.ExpressApp.Web.SystemModule.SystemAspNetModule();
this.module3 = new DelayedImagesXPO.Module.DelayedImagesXPOModule();
((System.ComponentModel.ISupportInitialize)(this)).BeginInit();
//
// DelayedImagesXPOAspNetApplication
//
this.ApplicationName = "DelayedImagesXPO";
this.CollectionsEditMode = DevExpress.ExpressApp.Editors.ViewEditMode.Edit;
this.Modules.Add(this.module1);
this.Modules.Add(this.module2);
this.Modules.Add(this.module3);
this.DatabaseVersionMismatch += new System.EventHandler<DevExpress.ExpressApp.DatabaseVersionMismatchEventArgs>(this.DelayedImagesXPOAspNetApplication_DatabaseVersionMismatch);
((System.ComponentModel.ISupportInitialize)(this)).EndInit();
}
}
}