Say I have a long-running process (e.g. Windows service) which needs to access a database from multiple threads.
DbContext is not thread safe, also it is a good idea not to keep it around for a long time (seems that an accepted best practice in the web environment is to create a new context for each request).
Based on EF docs, Contexts are expected to be short-lived and discarded, and as such have been implemented to be very lightweight and reutilize metadata whenever possible, so it seems like creating a new DB context for each database operation might be a way to go under these circumstances, but it does seem a bit excessive.
Thoughts?