I was wondering whether DatabaseFactory would return the same MyFinanceContext to all methods that call it. I do not have any prior experience with UnityContainer or (IoC in general), so I was not sure whether DatabaseFactory returns a new instance or the same
instance all the time.
My primary concern is what would happen if 2 requests were to come in at the same time. Would both requests be accessing the same MyFinanceContext object? If they are accessing the same MyFinanceContext object, then a lot can go wrong whenever one of them performs
My secondary concern is with DataContext dispose method. According to guidelines specified here (http://msdn.microsoft.com/en-us/data/jj729737
), it says with long running context, "The
chances of concurrency-related issues increase as the gap between the time when the data is queried and updated grows." This goes back to my understanding that DatabaseFactory will be returning the same MyFinanceContext on each Get() call.
Please share your opinion on this issue.