Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6080549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:04:26+00:00 2026-05-23T11:04:26+00:00

We’re rebuilding a multi-tenant asp.net web app and I’m having trouble nailing down the

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T11:04:27+00:00Added an answer on May 23, 2026 at 11:04 am

    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:

    • What is so bad about EAV, anyway?

    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.

    CREATE TABLE dbo.Corporations
    (
        CorporationID INT PRIMARY KEY,
        Name NVARCHAR(255) NOT NULL UNIQUE
        -- ... other columns ...
    );
    
    CREATE TABLE dbo.Vendors
    (
        VendorID INT PRIMARY KEY,
        Name NVARCHAR(255) NOT NULL UNIQUE
        -- ... other columns ...
    );
    
    
    CREATE TABLE dbo.AdditionalColumnSets
    (
        ColumnSetID INT PRIMARY KEY,
        Name NVARCHAR(255) NOT NULL UNIQUE -- e.g. Insurance
        -- ... other columns ...
    );
    
    CREATE TABLE dbo.AdditionalData
    (
        VendorID INT, -- foreign key here
        ColumnSetID INT, -- foreign key here
        ColumnName NVARCHAR(255),
        ColumnValue NVARCHAR(2048),
        -- you may want to extend this to store string, number, date
        -- data differently
        PRIMARY KEY(VendorID, ColumnSetID, ColumnName)
    );
    
    CREATE TABLE dbo.AdditionalDataAccess
    (
        CorporationID INT, -- foreign key here
        VendorID INT, -- foreign key here
        ColumnSetID INT, -- foreign key here
        HasAccess BIT NOT NULL DEFAULT (1),
        PRIMARY KEY(CorporationID, VendorID, ColumnSetID)
    );
    
    -- now, you can check for HasAccess in this table
    -- you can also infer from lack of being in this table
    -- whether that means they have access or they don't
    -- have access to a particular column set.
    
    -- ultimately, after you got hte base data from the
    -- standard tables like Vendors, the query would look 
    -- something like this, if presence in the 
    -- AdditionalDataAccess table is required:
    
    DECLARE @CorporationID INT = 1, @VendorID INT = 1;
    
    SELECT
        ColumnName,
        ColumnValue
    FROM
        dbo.AdditionalData AS ad
    WHERE
        VendorID = @VendorID
        AND EXISTS
        (
            SELECT 1
                FROM dbo.AdditionalDataAccess
                WHERE ColumnSetID = ad.ColumnSetID
                AND CorporationID = @CorporationID
                AND VendorID = @VendorID
                AND HasAccess = 1
        );
    
    -- you'll have to pivot or transform in the client to
    -- see these as columns instead of rows
    

    Hope this is useful and makes sense.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
We're building an app, our first using Rails 3, and we're having to build
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
Seemingly simple, but I cannot find anything relevant on the web. What is the
I have a view passing on information from a database: def serve_article(request, id): served_article
I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display
I am writing an app with both english and french support. The app requests

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.