/// <summary>
 /// 获取数据库中所有视图
 /// </summary>
 /// <returns></returns>
 public Task <IEnumerable <View> > GetViews()
 {
     return(Task.Factory.StartNew(() =>
     {
         using (var dbConnection = CreateDbConnection())
         {
             return dbConnection.ExecuteModels <View>(SqlServerSQL.SqlServerQueryViews());
         }
     }));
 }
 /// <summary>
 /// 获取数据库中所有外键关系
 /// </summary>
 /// <returns></returns>
 public Task <IEnumerable <ForeignKey> > GetForeignKeys()
 {
     return(Task.Factory.StartNew(() =>
     {
         using (var dbConnection = CreateDbConnection())
         {
             return dbConnection.ExecuteModels <ForeignKey>(SqlServerSQL.SqlServerQueryForeignKeys());
         }
     }));
 }
 /// <summary>
 /// 获取表中的所有列
 /// </summary>
 /// <param name="tableName"></param>
 /// <returns></returns>
 public Task <IEnumerable <Column> > GetColumns(string tableName)
 {
     return(Task.Factory.StartNew((_tableName) =>
     {
         using (var dbConnection = CreateDbConnection())
         {
             var sql = SqlServerSQL.SqlServerQueryTableByName((string)_tableName);
             return dbConnection.ExecuteModels <Column>(sql);
         }
     }, tableName));
 }
        /// <summary>
        /// 获取数据库中所有存储过程
        /// </summary>
        /// <returns></returns>
        public Task <IEnumerable <Procedure> > GetProcedures()
        {
            return(Task.Factory.StartNew(() =>
            {
                using (var dbConnection = CreateDbConnection())
                {
                    var list = new List <Procedure>();
                    var result = dbConnection.ExecuteModels <Procedure>(SqlServerSQL.SqlServerQueryProcedures());

                    list.AddRange(result);
                    list.RemoveAll((item) => { return item.ProcedureDescription == "1"; });
                    return list.AsEnumerable();
                }
            }));
        }