Reputation: 1647
I have an existing ASP.NET web forms site that uses entityframework to connect to a single SQL database as a datasource.
I've been asked to convert the app to a multi-tenant application to cater for a new client.
The codebase is identical and the easiest way I can see is simply connect the app to a different copy of the database based on a field in the user table.
Questions:
1) where do I store the users? Currently there is a single users table in the existing app, do I need to split this out to a 3rd database that is common between the two tenants?
2) The big one: How do I connect entityframework to a different database depending on a field in the user table? Currently the database is set from web.config. I would like to do this with as little code change as possible!
Upvotes: 0
Views: 1007
Reputation: 14723
If using Code-First, I strong recommend doing this on the global level instead of on each individual query. See https://github.com/jbogard/EntityFramework.Filters.
Upvotes: 1
Reputation: 175
I think, in your case multitenancy is just splitter inside each table on your app.
Upvotes: 0