Cannot access a disposed object. A common cause of this error is disposing a context

后端 未结 4 2395
梦谈多话
梦谈多话 2020-12-16 13:32

I have written a simple application and when I navigate to my edit page the below error pops up.

Microsoft.EntityFrameworkCore.Query[10100]

<
4条回答
  •  眼角桃花
    2020-12-16 13:47

    This is another anwser for who gonna read this topic.

    I tried to trigger asnyc method with javascript. Because of that it can't triggered and so result didn't calculated by async method. I was returning json object to view like this in dotnet core mvc.

    return Json(_service.AsyncMethod(parameter));
    

    My IActionResult is not async so I can't add "await". I just add ".Result" and it calculate result.

    return Json(_service.AsyncMethod(parameter).Result);
    

提交回复
热议问题