public async Task <DatabaseTablesDto> GetAsync(string key) { TDatabase model; if (key.IsMatch("^[0-9a-zA-Z]{32}$")) { model = await _repository.QueryByIdAsync(key); } else { model = await _repository.QueryByIdAsync(key, nameof(TDatabase.Code)); } var provider = (ProviderType)model.Provider; var uw = new UnitOfWork(model.ConnectionString, provider.ToString()); var service = uw.Service(); var tables = await service.GetTablesAsync(); return(new DatabaseTablesDto { Name = model.Name, DbName = service.DbName, Provider = service.Provider, Tables = tables }); }