Invalidating/Disabling Entity Framework cache

前端 未结 2 757
渐次进展
渐次进展 2020-12-09 16:46

I see there are plenties of question on EF cache, but I have found no solution yet to my problem.

The straight question is

How do I completely disable Enti

2条回答
  •  无人及你
    2020-12-09 17:52

    I had this trouble too, but I could fix it.

    I'm using Repository Pattern and using default DI of .Net Core. I've been using AddSingleton(...), but it's wrong to use with DbContext.

    So, I've changed to AddScoped, like I read from docs: Scoped lifetime services are created once per request.

    It has solved my problem.

    You must read this section from ms docs: Service Lifetimes and Registration Options

提交回复
热议问题