/// <summary>
 /// 获取所有用户信息表
 /// </summary>
 /// <returns></returns>
 public static List <string> GetAllTables(SqliteContext context)
 {
     try
     {
         var tables = context.Find(new SQLiteString("select * from sqlite_master where type = 'table'"));
         return(tables.Select(table => DynamicConvert.ToSafeString(table.name)).Cast <string>().ToList());
     }
     catch
     {
         LogHelper.Error("上层获取数据库表信息失败. 转底层获取!");
         return(ButtomGetAllTables(context.DataSource, ""));
     }
 }
        /// <summary>
        /// 获取表中的主键信息;
        /// </summary>
        /// <param name="context"></param>
        /// <param name="tableName"></param>
        /// <returns></returns>
        private static List <string> GetPrimaryKey(SqliteContext context, string tableName)
        {
            var keyAll = new List <string>();

            try
            {
                var sqlite = new SqliteContext("")
                {
                    DataSource = context.DataSource.Replace("_recovery", "")
                };
                var data =
                    sqlite.Find(
                        new SQLiteString("select * from sqlite_master where type = 'table' and tbl_name = '" + tableName +
                                         "';"));
                if (data == null || data.Count == 0)
                {
                    return(keyAll);
                }
                var lists = Regex.Matches(DynamicConvert.ToSafeString(data[0].sql), @"\(.*\)");
                if (lists.Count == 0)
                {
                    return(keyAll);
                }
                var columns = lists[0].Value.TrimStart('(').TrimEnd(')').Split(',');
                foreach (var column in columns)
                {
                    if (!column.Contains("PRIMARY KEY"))
                    {
                        continue;
                    }
                    var result = Regex.Matches(column, "'.*'");
                    if (result.Count == 0 || result.Count > 1)
                    {
                        continue;
                    }
                    keyAll.Add(DynamicConvert.ToSafeString(result[0].Value).Replace("'", ""));
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(string.Format("获取表{0}主键信息失败", tableName), ex);
            }
            return(keyAll);
        }