asp.net - Database design - one database, multiple sites -


i know question has been asked many times before couldn't find exact answer mine. please let me ask here.

we built cms control 1 site. company expanding , have couple more sites identical core structure. decided go 1 database easy maintenance later on.

we have 10 tables. example, pages, news, settings (different each site), ...

it doesn't sound idea if add 1 app_id (or site_id) column every each of these tables know records particular site should pull out.

for instance,

pages: pageid   |   body   |   siteid 1        | abc      |   1 2        | cde      |   1 3        | aafd     |   2 4        | gsgs     |   2 5        | feg      |   3 

i think abundant add siteid column every table in database.

i looked @ multi-tenant architecture don't know how apply our sites cms.

what best way handle situation, please help. enlightenment appreciated.

simple code

we've been reviewing various strategies multi-tenant single database.

if don't want add site identifier tables give each tenant own schema , set of tables. each tenant have own connection string provides access schema (you need switch connection @ runtime (easy enough both ef , nh if using these).

however, option opted introduce additional level our application such each component of application (in case news, pages etc.) represented feature in database.

each site has collection of feature "instances" , data stored each of features (a blog might have posts, tags, categories) has reference feature instance (not site).

this add additional complexity have found extremely flexible , decouples our feature data site (make possible move feature instances between sites if wanted to).


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -