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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T07:09:03+00:00 2026-06-17T07:09:03+00:00

I am been using entity framework for my application. Unfortunately I can’t make expressions

  • 0

I am been using entity framework for my application. Unfortunately I can’t make expressions like this one in entity framework:

List<MyUser> users = (from user in database.MyUsers
                      join app in database.MyApplications 
                          on user.ApplicationId equals app.Id
                      where app.Name == this._applicationName 
                          && user.MyRoles.Contains(existingRole)
                      select user).ToList();

Any other approaches to this one. I don’t want to change my database or my models. In my case the relationship between MyUser and MyRole is many to many with a glue table.

This is how the MyUser class is declared:

public partial class MyUser
{
    public MyUser()
    {
        this.MyApiTokens = new HashSet<MyApiToken>();
        this.MyLandingPages = new HashSet<MyLandingPage>();
        this.MyPresentations = new HashSet<MyPresentation>();
        this.MySlides = new HashSet<MySlide>();
        this.MyUserSettings = new HashSet<MyUserSetting>();
        this.MyRoles = new HashSet<MyRole>();
    }

    public System.Guid Id { get; set; }
    public string UserName { get; set; }
    public string Password { get; set; }
    public string EmailAddress { get; set; }
    public int ApplicationId { get; set; }
    public System.DateTime CreateDate { get; set; }
    public System.DateTime LastActivityDate { get; set; }
    public System.DateTime LastLockoutDate { get; set; }
    public System.DateTime LastLoginDate { get; set; }
    public System.DateTime LastPasswordChangedDate { get; set; }
    public string PasswordQuestion { get; set; }
    public string PasswordAnswer { get; set; }
    public string Comment { get; set; }
    public bool IsLocked { get; set; }
    public bool IsApproved { get; set; }

    public virtual ICollection<MyApiToken> MyApiTokens { get; set; }
    public virtual MyApplication MyApplication { get; set; }
    public virtual ICollection<MyLandingPage> MyLandingPages { get; set; }
    public virtual ICollection<MyPresentation> MyPresentations { get; set; }
    public virtual ICollection<MySlide> MySlides { get; set; }
    public virtual ICollection<MyUserSetting> MyUserSettings { get; set; }
    public virtual ICollection<MyRole> MyRoles { get; set; }
}
  • 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-06-17T07:09:04+00:00Added an answer on June 17, 2026 at 7:09 am

    Assuming MyRoles is an association property in the entity model (i.e. maps to a table), you may want to make the matching explicit on the primary key of the role object. For example:

    user.MyRoles.Any(r => r.RoleId == existingRole.RoleId)
    

    There isn’t enough information in your question to give an exact answer, though.

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

Sidebar

Related Questions

Can anyone help? I have been using the entity framework and its going well
I have been using Entity Framework CTP with Code-First as in this tutorial by
I have been playing with Entity Framework and so far I like using it
I got a MVC3 application using Entity Framework 4 and SQL Server. How can
I have been using a lot Entity Framework in a MVVM WPF application recently
EDIT: Duplicate of Should Entity Framework Context be Put into Using Statement? I've been
I've been using Database First, EF 4.1 I am getting The entity type List`1
I'm using Entity framework in web application. ObjectContext is created per request (using HttpContext),
I have a ASP.NET MVC 3 application, using Entity Framework 4 to handle Data
I have been experimenting recently with Silverlight, RIA Services, and Entity Framework using .NET

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.