We’re rebuilding a multi-tenant asp.net web app and I’m having trouble nailing down the most appropriate database structure. I’ve read loads of questions/answers on SO and the Microsoft multi-tenancy architecture article, but can’t seem to find the info I’m looking for.
The application has 2 types of end users:
- A vendor who inputs their company’s information into the database (things like address, contact info, insurance amounts, etc.)
- A corporation hiring the vendors. The corporation user logs in and views the data the vendor has entered. Corporation users can search vendors, run reports, etc.
Issue:
- Each corporation that uses the system wants different information from the vendors. They all want basic info like address and contact info, but then some will want an abritrary number of additional fields (specific insurance info or something) that apply only to that corp.
My inclination is to use Name-Value pairs for the database fields so we can extend the database as needed for each corporation. My questions:
- Does this seem like the best approach given the info above and the fact that name-value will significantly complicate querying/filtering vendors. The other option I’m considering is creating a separate “additional fields” table for each corporation that has the fields required by that particular corp.
Input/answers greatly appreciated.
I’ve done EAV solutions in the past, and they work quite well. I think this could work for your situation if I understand it right (that the vendor-corporation relationship is many-to-many / all-to-many). I’ve written about the pros and cons of EAV here:
Whether this is appropriate for you will depend on a couple of things. Are the “additional fields” you mention a relatively fixed set, or are they added on demand? If they are a relatively fixed set, then you could just have an access (not Microsoft Access) table that tells whether each set of columns is relevant for that vendor-corp pair.
Hope this is useful and makes sense.