Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

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.

share|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
    
Ok. Thanks for the help –  user1741807 Oct 21 '12 at 8:42
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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