/// <summary>
 /// 更新记事本数据库文件
 /// </summary>
 /// <param name="fileName"></param>
 private void NotepadUpdateDBFile(SQLiteConnection connection)
 {
     try
     {
         using (var context = new NotepadContext(connection, false))
         {
             var defaultVersionInfo = context.VersionInfo.Where(x => x.Key == "Default").FirstOrDefault();
             int version            = defaultVersionInfo.VersionNumber;
             int versionMax         = UpdateNotepadScript.Keys.Max();
             while (version < versionMax)
             {
                 version += 1;
                 if (UpdateNotepadScript.ContainsKey(version))
                 {
                     //更新表结构
                     context.Database.ExecuteSqlCommand(UpdateNotepadScript[version]);
                     //更新版本号
                     defaultVersionInfo.VersionNumber = version;
                     context.SaveChanges();
                 }
             }
         }
     }
     catch (Exception e)
     {
         var message = e.Message;
     }
 }
        /// <summary>
        /// 创建记事本数据库文件
        /// </summary>
        /// <param name="fileName"></param>
        private void NotepadCreateDBFile(SQLiteConnection connection)
        {
            try
            {
                using (var context = new NotepadContext(connection, false))
                {
                    Directory.CreateDirectory(basePath);
                    //SQLiteConnection.CreateFile(path + dbName);

                    //创建记事本表
                    context.Database.ExecuteSqlCommand(@"CREATE TABLE [NotepadInfo] (
                    [Id] nvarchar  PRIMARY KEY NOT NULL,
                    [NotepadContent] nvarchar  NOT NULL,
                    [CreateTime] datetime  NOT NULL );");

                    //创建数据库版本表
                    context.Database.ExecuteSqlCommand(@"CREATE TABLE [VersionInfo] (
                    [Key] nvarchar  PRIMARY KEY NOT NULL,
                    [VersionNumber] INTEGER  NOT NULL,
                    [CreateTime] datetime  NOT NULL );");

                    var info = new VersionInfo
                    {
                        Key           = "Default",
                        VersionNumber = 0,
                        CreateTime    = DateTime.Now
                    };
                    context.VersionInfo.Add(info);
                    context.SaveChanges();
                }
            }
            catch (Exception e)
            {
                var message = e.Message;
            }
        }