I am working on a web application that is using Entity Framework, the SaveChanges method has been overriden to allow log entries of changes made to the database.
Now on MSDN it states that the database context is not thread safe. So I have 2 questions.
1) If I want to create the log entries in a thread do I have to use a new DB Context for each thread?
using (var repository = new LoggingRepository(new LoggingDbContext()))
{
((ILoggingRepository)repository).Persist(auditEntries);
}
Update: The logging database is a separate database from the one where the SaveChanges is overriden
2) Does the application create a new DB Context for each user that connects to the application through IIS?