Skip to content

MVC5: Asynchronous child actions Not supported #61

Closed
@sanilpaul

Description

@sanilpaul

what is the recommended way to execute asynchronous actions (database access) through child actions in MVC5? I understand its very subjective to what i do in the child action. In my case, its only async queries to sql server using EF6.

Is wrapping in a task.run has any side effects in this case or is there any better way microsoft recommends other than changing to Synchronous?

@Html.Action("SampleChildAction)

public PartialViewResult SampleChildAction()
{
    Task.Run(async () => { await asyncMethod(); }).Result; 
    return PartialView("_SampleChildActionView");
}

I couldn't locate anything guidance from microsoft. I would appreciate any help.
https://justsimplycode.com/2016/09/04/child-action-in-mvc-5-does-not-support-async/
dotnet/aspnetcore#343

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions