I have a Silverlight application with WCF and entity framework.

Is it possible to have one database per user. So when the the user log in, the user will use his own database?


Yes, it's certainly possible.

What you will need is a central database that just holds all the user login details (you could use the standard ASP.NET membership database for this). This would allow the user to gain access to the system.

Then you would need another table to hold the connection details for each user. This will allow them to access their database and no one else's. You create the database connection from this data. This is separate to the login database connection, so use a new connection rather than reusing the existing one.

| improve this answer | |
  • And then change the connectionstring at runtime? – user1741807 Oct 21 '12 at 8:30
  • @user1741807 - You'll could (indeed should) use a separate connection for the login and the actual data access. – ChrisF Oct 21 '12 at 8:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.