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 796465
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T22:38:38+00:00 2026-05-14T22:38:38+00:00

I have a scenario where: there are two (or more) tables that represent independent

  • 0

I have a scenario where:
there are two (or more) tables that represent independent items. lets say Users and Companies

Both of these tables need addresses stored. Each one can have one or more address

In a normal 1 to many scenario Addresses table woudl just have a UserId or a CompanyId creating a normal 1 to many relationship.

In this case i have a few approaches i can think of

  1. the Addresses table could have both a UserId and a CompanyId and only one would be used for each record.

  2. 2 keys could be used ObjectId and ObjectType So Object id would have a UserId or a CompanyId, and ObjectType woudl be User or Company

  3. Create an ObjectTable and add ObjectId to Users and Companies. Addresses would then have an OjbectId

I do not really like any of these solutions. i am wondering what is the best approach here.

On another note i will most likely user linqtosql for my data access layer.

  • 1 1 Answer
  • 3 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-14T22:38:39+00:00Added an answer on May 14, 2026 at 10:38 pm

    I’m not sure about the implications regarding Linq-to-SQL, but one model for solving this problem is to use multiple Junction Tables.

    In your case, you would have a table called AddressUsers that has two columns: AddressId and UserID and a table called AddressCompanies that has the columns AddressId and CompanyId.

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

Sidebar

Related Questions

So lets say I have the following scenario. http://website.com:8080 and http://website.com:8080/demo Is there any
Let's say I have the following scenario. A database of LocalLibrary with two tables
I have scenario, I have two update panels on the page (both have update
Let me try to explain the scenario. I have two tables A (Columns -
Here's my scenario: I have two tables A, B which (for the sake of
I have a WCF service deployed on two or more remote machines and there
I have two tables that share a one to one relationship (in truth its
I have two distinct scenarios. One, where there is a many to many case,
I have a ASP.NET MVC 3 app with a common scenario where there is
Scenario I have a Windows Forms Application. Inside the main form there is a

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.