ningshuxia
2024-04-30 b50a06a3185619c4cbbc521ab026f1bfa4d13aae
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
namespace IStation.DAL
{
    public class DbInitial
    {
 
        /// <summary>
        /// 初始数据库
        /// </summary> 
        /// <param name="backup"></param>
        /// <param name="stringDefaultLength"></param>
        /// <returns></returns>
        public static bool InitTables(bool backup = false, int stringDefaultLength = 250)
        {
            var db = ConfigHelper.GetSqlSugarClient();
            if (db == null)
                return false;
 
            Type[] types = new Type[] {
                      // typeof(Entity.ScheduleCombine),
                    //   typeof(Entity.ScheduleCombineLog),
                       typeof(Entity.ScheduleAnaLog),
 
                   };
            db.DbMaintenance.CreateDatabase();
            if (backup)
            {
                db.CodeFirst.BackupTable().InitTables(types);
            }
            else
            {
                db.CodeFirst.InitTables(types);
            }
            return true;
        }
 
 
 
    }
 
}