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

  • Home
  • SEARCH
  • 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 4616206
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:56:56+00:00 2026-05-22T01:56:56+00:00

I am writing a backend surveys database. The database is the backend for multiple

  • 0

I am writing a backend surveys database. The database is the backend for multiple applications that are used for gathering survey type data. I have a schema that includes a table that designates the application and what questions belong to that application.

now I need to setup users and userroles…

each user may have access to 1 or more applications
each application has 1 or more users

each user may have 1 role in the application they have access to
each role may exist in 1 or more applications
each user may have different roles in each application.

app1 has 15 users 1 user is admin
app1 has 2 roles defined for user access

app2 has 30 users admin user from app1 has access but is regular user
2 admin users in app2 exist in app1 as normal users
app2 has 4 roles defined for user access.

WARNING FREE FORM THOUGHT PROCESS

so I have

Application ->ApplicationUsers<-Users

maybe I only need one joining table then like this?

enter image description here

Would that be correct? Would it work in EF 4.0?

What would be the correct way to make this work?

  • 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-22T01:56:57+00:00Added an answer on May 22, 2026 at 1:56 am

    Let’s assume that this

    each user may have 1 role in the
    application they have access to each
    role may exist in 1 or more
    applications each user may have
    different roles in each application.

    should be punctuated like this.

    Each user may have 1 role in the
    application they have access to, each
    role may exist in 1 or more
    applications, each user may have
    different roles in each application.

    If that first clause means that each user must have one and no more than one role in each application they have access to, then your schema won’t work. The compound primary key {ApplicationId, UserID, RoleID} in ApplicationUserRoles allows multiple roles per user.

    To limit the constraint “one row (and one role) per user per application”, the primary key for ApplicationUserRoles should be just {ApplicationID, UserID}.

    Also, if UserID is unique in the table Users, it should probably be the primary key, and you should probably drop the column “ID” from that table.

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

Sidebar

Related Questions

Does anyone have some good hints for writing test code for database-backend development where
I have spent most of my development career writing backend code, or front-end apps
I am writing a multimedia archive database backend and I want to use joined
I am writing my first Android database backend and I'm struggling to unit test
I'm writing a reasonably complex web application. The Python backend runs an algorithm whose
Writing a JSP page, what exactly does the <c:out> do? I've noticed that the
When writing multi-threaded applications, one of the most common problems experienced are deadlocks. My
When writing multithreaded applications, one of the most common problems experienced is race conditions.
Is there an open source survey engine for java that will allow branching of
I'm writing a backend for a mobile web-app based in Java and I was

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.