Beispiel #1
0
        private async Task <List <TabelaEstrangeira> > RetornarListaTabelaEstrangeira(string tabela)
        {
            List <TabelaEstrangeira> itens = null;
            var    repositorio             = new SqlClient.Repositorio(IdServidor);
            string chavePrimaria           = "";
            string descricao = "";

            try
            {
                chavePrimaria = (await repositorio.RetornarColunasChavePrimariaTabelaAsync(tabela, Schema, Database))[0].Nome;
                descricao     = await repositorio.SelecionarDescricaoChaveEstrangeiraConfiguracaoTabelaAsync(Database, Schema, Nome, chavePrimaria);

                if (string.IsNullOrEmpty(descricao))
                {
                    descricao = (await repositorio.RetornarColunasAsync(Database, Schema, tabela)).FirstOrDefault().Nome;
                }
                itens = await repositorio.SelectTabelaAsync(chavePrimaria, descricao, tabela, Schema, Database);
            }
            catch (Exception)
            {
                throw;
            }
            return(itens);
        }