/
WebApplication.cs
69 lines (65 loc) · 3.95 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
67
68
69
using System;
using DevExpress.ExpressApp;
using System.ComponentModel;
using DevExpress.ExpressApp.Web;
using System.Collections.Generic;
using DevExpress.ExpressApp.Xpo;
namespace ChangeEditMask.Web {
// For more typical usage scenarios, be sure to check out http://documentation.devexpress.com/#Xaf/DevExpressExpressAppWebWebApplicationMembersTopicAll
public partial class ChangeEditMaskAspNetApplication : WebApplication {
private DevExpress.ExpressApp.SystemModule.SystemModule module1;
private DevExpress.ExpressApp.Web.SystemModule.SystemAspNetModule module2;
private ChangeEditMask.Module.ChangeEditMaskModule module3;
private ChangeEditMask.Module.Web.ChangeEditMaskAspNetModule module4;
public ChangeEditMaskAspNetApplication() {
InitializeComponent();
}
protected override void CreateDefaultObjectSpaceProvider(CreateCustomObjectSpaceProviderEventArgs args) {
args.ObjectSpaceProvider = new XPObjectSpaceProvider(args.ConnectionString, args.Connection, true);
}
private void ChangeEditMaskAspNetApplication_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://help.devexpress.com/#Xaf/CustomDocument2795\r\n" +
"'Database Security References' at http://help.devexpress.com/#Xaf/CustomDocument3237\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 ChangeEditMask.Module.ChangeEditMaskModule();
this.module4 = new ChangeEditMask.Module.Web.ChangeEditMaskAspNetModule();
((System.ComponentModel.ISupportInitialize)(this)).BeginInit();
//
// ChangeEditMaskAspNetApplication
//
this.ApplicationName = "ChangeEditMask";
this.CollectionsEditMode = DevExpress.ExpressApp.Editors.ViewEditMode.Edit;
this.Modules.Add(this.module1);
this.Modules.Add(this.module2);
this.Modules.Add(this.module3);
this.Modules.Add(this.module4);
this.DatabaseVersionMismatch += new System.EventHandler<DevExpress.ExpressApp.DatabaseVersionMismatchEventArgs>(this.ChangeEditMaskAspNetApplication_DatabaseVersionMismatch);
((System.ComponentModel.ISupportInitialize)(this)).EndInit();
}
}
}