title: Windows Service EFCore with DI Giving Stale Data
body: <p>I am using EFCore with .Net Core. EFCore works fine with WebApi as the DbContext is scope based. In Windows service we are using same DbContext with DI and using repository pattern with unit of work. The problem is, sometimes we get stale data from EFCore due to same context getting used due to DI over Windows service lifetime. How can we handle it with DI and how to create a new DBContext every time we run our Windows service process?</p>