-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUtil.cs
More file actions
48 lines (44 loc) · 1.31 KB
/
Util.cs
File metadata and controls
48 lines (44 loc) · 1.31 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
using MailingProject.Controller;
using MySql.Data.EntityFramework;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Data.Entity.Migrations.Model;
using System.Data.Entity.Migrations.Sql;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace MailingProject
{
class Util
{
private static MailingAppDbContext dbContext;
public static void initDb()
{
if (dbContext == null)
dbContext = new MailingAppDbContext();
var initializer = new CreateDatabaseIfNotExists<MailingAppDbContext>();
initializer.InitializeDatabase(dbContext);
}
}
public class CustomizedMySqlMigrationSqlGenerator : MySqlMigrationSqlGenerator
{
#region Override members
protected override MigrationStatement Generate(CreateIndexOperation op)
{
var currentCulture = Thread.CurrentThread.CurrentCulture;
try
{
Thread.CurrentThread.CurrentCulture = new CultureInfo("en");
return base.Generate(op);
}
finally
{
Thread.CurrentThread.CurrentCulture = currentCulture;
}
}
}
#endregion
}