Using SubSonic v2.3 in a web app. Each client (200+) will have their own database. We have been putting in the connect string for the client when we create the repository for the database call. What we're seeing now is that client A may make a request at about the same time as client B. Client A may get client B's data. This seems to happen when each client is requesting the same page. I know SubSonic is built for a single db but I've read several posts about switching the connect string in the default provider to get multi database support. Any insights on whatI may need to check would be helpful.
+2
A:
It all resolves around threading, as you're seeing. With 2.2 (the current version), you can wrap your calls with SharedDbConnectionScope. This will reset the connection string:
using(new SharedDbConnectionScope("my connection string")){
//.. do your thing here
}
This will isolate the call in a thread-safe way and change your connection string. I need to update our docs on this...
Rob Conery
2009-07-04 19:14:39
I've noticed that 3.0 can have multiple providers. Would this be the way to sove this in 3.0. I've thought about making multiple providers in 2.3.
JayGlynn
2009-07-05 18:54:48