I have a web app and a windows service app.
The web app injects IPersonService
into its MVC controllers.
The windows app also uses IPersonService
.
The service takes 3 dependencies on IPersonRepo, IAddressRepo, IEmploymentRepo
for example.
The implementations of the repositories take a DBContext
for Entity Framework use.
In a web app I can register the DBContext as Bind<MyContext>().ToSelf().InRequestScope();
In the windows service its trickier. I could leave it so the DBContext is transient but that seems wrong.
So I thought I could make the services be the scope to determine the life cycyle of the DBContext but am completely unsure how I would go about that to make sure it worked well for a web app and windows service app.
Any help would be greatly appreciated