Skip to main content

Store Stored procedure assíncrona

ExecutarAo tentar executar procedure assincronamente

public async Task<ActionResult> Index()
    {
        Stopwatch watch = new Stopwatch();
        watch.Start();
        ContentManagement service = new ContentManagement();
        var contentTask = service.MesesAsync();
        var content = await contentTask;
        watch.Stop();                    
        ViewBag.WatchMilliseconds = watch.ElapsedMilliseconds;
        return View("Index");
     }

public async Task<List<SP_MESES_BUSCA_Result>> MesesAsync()
    {
        var ListarMes = await db.SP_MESES_BUSCA().ToList();
        return ListarMes;
    }

ErroRetorna o erro:

Cannot await 'System.Collections.Generic.List<MAPA.Models.SP_MESES_BUSCA_Result>'

Cannot await 'System.Collections.Generic.List<MAPA.Models.SP_MESES_BUSCA_Result>'

Store procedure assíncrona

Executar procedure assincronamente

public async Task<ActionResult> Index()
    {
        Stopwatch watch = new Stopwatch();
        watch.Start();
        ContentManagement service = new ContentManagement();
        var contentTask = service.MesesAsync();
        var content = await contentTask;
        watch.Stop();                    
        ViewBag.WatchMilliseconds = watch.ElapsedMilliseconds;
        return View("Index");
     }

public async Task<List<SP_MESES_BUSCA_Result>> MesesAsync()
    {
        var ListarMes = await db.SP_MESES_BUSCA().ToList();
        return ListarMes;
    }

Erro

Cannot await 'System.Collections.Generic.List<MAPA.Models.SP_MESES_BUSCA_Result>'

Stored procedure assíncrona

Ao tentar executar procedure assincronamente

public async Task<ActionResult> Index()
    {
        Stopwatch watch = new Stopwatch();
        watch.Start();
        ContentManagement service = new ContentManagement();
        var contentTask = service.MesesAsync();
        var content = await contentTask;
        watch.Stop();                    
        ViewBag.WatchMilliseconds = watch.ElapsedMilliseconds;
        return View("Index");
     }

public async Task<List<SP_MESES_BUSCA_Result>> MesesAsync()
    {
        var ListarMes = await db.SP_MESES_BUSCA().ToList();
        return ListarMes;
    }

Retorna o erro:

Cannot await 'System.Collections.Generic.List<MAPA.Models.SP_MESES_BUSCA_Result>'

Fonte Link

Store procedure assíncrona

Executar procedure assincronamente

public async Task<ActionResult> Index()
    {
        Stopwatch watch = new Stopwatch();
        watch.Start();
        ContentManagement service = new ContentManagement();
        var contentTask = service.MesesAsync();
        var content = await contentTask;
        watch.Stop();                    
        ViewBag.WatchMilliseconds = watch.ElapsedMilliseconds;
        return View("Index");
     }

public async Task<List<SP_MESES_BUSCA_Result>> MesesAsync()
    {
        var ListarMes = await db.SP_MESES_BUSCA().ToList();
        return ListarMes;
    }

Erro

Cannot await 'System.Collections.Generic.List<MAPA.Models.SP_MESES_BUSCA_Result>'