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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:42:51+00:00 2026-05-16T10:42:51+00:00

No foreign keys defined in the database. So I’ve setup associations. problem: can’t seem

  • 0

No foreign keys defined in the database. So I’ve setup associations.

problem: can’t seem to be able to reference the Role table as expected:

I can get as far as u.UserNamesInRole then can’t make the jump to role table.

IEnumerable<fmwebapp1.Old_App_Code.TelerikUsersDataContext.User> userList = (from u in dbTelerik.Users
where u.UsersInRoles.Role.Name = "admin"
select u.UsersInRoles);

alt text

  • 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-16T10:42:52+00:00Added an answer on May 16, 2026 at 10:42 am

    In a many-to-many relationship, when I want results from one side only, filtered by values on the other side, I usually start my query in the middle of the relation:

    To get a role’s users:

    var users = from ur in context.UsersInRole
                where ur.Role.Name == "admin"
                select ur.User;
    

    To get a user’s roles:

    var roles = from ur in context.UsersInRole
                where ur.User.UserName == "Jon"
                select ur.Role
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So you have a relational database and you define some foreign keys for reference
I want to get relations (or foreign keys) of a Sql Server Table in
I added a bunch of foreign keys to the database project when previously there
I have a relational table with two foreign-keys pointing to same table. The first
I want to find all foreign keys in a table, and for each foreign
My situation may be a bit abnormal, but I have foreign keys defined in
Consider a database(MSSQL 2005) that consists of 100+ tables which have primary keys defined
I have a database in which the tables do not have primary/foreign keys. This
I've defined all foreign keys and cascade operations in MySQL, should I also map
Since foreign keys are not supported by partitioned mySQL databases for the moment, I

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.