forked from BlogEngine/BlogEngine.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGlobal.asax
More file actions
90 lines (83 loc) · 3.56 KB
/
Global.asax
File metadata and controls
90 lines (83 loc) · 3.56 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
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<%@ Application Language="C#" %>
<%@ Import Namespace="BlogEngine.NET.App_Start" %>
<script RunAt="server">
void Application_BeginRequest(object sender, EventArgs e)
{
var app = (HttpApplication)sender;
BlogEngineConfig.Initialize(app.Context);
}
void Application_PreRequestHandlerExecute(object sender, EventArgs e)
{
BlogEngineConfig.SetCulture(sender, e);
}
void Application_Error(object sender, EventArgs e)
{
Exception ex = Server.GetLastError();
Common.Site.Classes.Exception.ErrorDatabaseManager.AddException(ex, ex.GetType());
}
void Application_Start()
{
try
{
System.Data.Entity.Database.SetInitializer(new System.Data.Entity.MigrateDatabaseToLatestVersion<BlogEngine.Core.Data.Context.BlogEngineManagementContext, BlogEngine.Core.Migrations.Configuration>());
var configuration = new BlogEngine.Core.Migrations.Configuration();
configuration.AutomaticMigrationsEnabled = true;
configuration.AutomaticMigrationDataLossAllowed = true;
var migrator = new System.Data.Entity.Migrations.DbMigrator(configuration);
migrator.Update();
}
catch (Exception exception)
{
Common.Site.Classes.Exception.ErrorDatabaseManager.AddException(exception, exception.GetType());
}
try
{
var configurationEmail = new BlogEngine.Core.Migrations.CEmail();
configurationEmail.AutomaticMigrationsEnabled = true;
configurationEmail.AutomaticMigrationDataLossAllowed = true;
var migratorEmail = new System.Data.Entity.Migrations.DbMigrator(configurationEmail);
migratorEmail.Update();
}
catch (Exception exception)
{
Common.Site.Classes.Exception.ErrorDatabaseManager.AddException(exception, exception.GetType());
}
try
{
var configurationError = new BlogEngine.Core.Migrations.CError();
configurationError.AutomaticMigrationsEnabled = true;
configurationError.AutomaticMigrationDataLossAllowed = true;
var migratorError = new System.Data.Entity.Migrations.DbMigrator(configurationError);
migratorError.Update();
}
catch (Exception exception)
{
Common.Site.Classes.Exception.ErrorDatabaseManager.AddException(exception, exception.GetType());
}
try
{
var configurationSite = new BlogEngine.Core.Migrations.CSite();
configurationSite.AutomaticMigrationsEnabled = true;
configurationSite.AutomaticMigrationDataLossAllowed = true;
var migratorSite = new System.Data.Entity.Migrations.DbMigrator(configurationSite);
migratorSite.Update();
}
catch (Exception exception)
{
Common.Site.Classes.Exception.ErrorDatabaseManager.AddException(exception, exception.GetType());
}
try
{
var configurationPayment = new BlogEngine.Core.Migrations.CPayment();
configurationPayment.AutomaticMigrationsEnabled = true;
configurationPayment.AutomaticMigrationDataLossAllowed = true;
var migratorPayment = new System.Data.Entity.Migrations.DbMigrator(configurationPayment);
migratorPayment.Update();
}
catch (Exception exception)
{
Common.Site.Classes.Exception.ErrorDatabaseManager.AddException(exception, exception.GetType());
}
//Logger.Info("Web Start");
}
</script>