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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T01:03:16+00:00 2026-06-12T01:03:16+00:00

My Linq statement gives an error. Now the issue is that I’m at a

  • 0

My Linq statement gives an error.
Now the issue is that I’m at a project that uses a custom built datalayer, so I don’t know wether I’m creating the wrong Linq statement or that the datalayer just can’t handle it.

So here’s the statement:

IQueryable<Affiliate> temp;

Func<RolePersonRole, bool> func;
if (roleMustBePrimary)
{
    func  = role => role.RolePersonRoleIsPrimary.Value == true;    
}
else
{
    func = role => role.RoleId == role.RoleId;

}
temp = (from affiliate in DataFacade.Instance().Tables(SessionTicket).Affiliates()
        join role in DataFacade.Instance().Tables(SessionTicket).RolePersonRoles().Where(func) on affiliate.PersonId
            equals role.PersonId
        where role.RoleId == roleId
                && affiliate.AffiliateAssuranceLevel == assuranceLevelEnum
        select affiliate);

The meaning is that if the bool roleMustBePrimary is true, a where statement should be added, and if it’s false, it should not be added (hence the role => role.RoleId == role.RoleId).

The error I’m getting is:

The expression of type
‘System.Collections.Generic.IEnumerable`1[SkillsNG.Modules.RolePersons.Entities.RolePersonRole]’
is not a sequence

  • 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-12T01:03:17+00:00Added an answer on June 12, 2026 at 1:03 am

    As Wouter said, you do not need the .Where(), you can express it more clearly:

    var temp = 
        from affiliate in DataFacade.Instance().Tables(SessionTicket).Affiliates()
        join role in 
            from r in DataFacade.Instance().Tables(SessionTicket).RolePersonRoles()
            where roleMustBePrimary && r.RolePersonRoleIsPrimary.Value 
                  || !roleMustBePrimary
            select r
        on affiliate.PersonId equals role.PersonId
        where role.RoleId == roleId
              && affiliate.AffiliateAssuranceLevel == assuranceLevelEnum
        select affiliate;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How to write LINQ statement that returns ROWNUMBER of element with id == something?
I have a LINQ statement that returns an anonymous type. I need to get
Here's a LINQ statement that I am trying to execute var usersQuery = from
I'm receiving this error in my Linq statement --- Cannot implicitly convert type 'System.Collections.Generic.IEnumerable'
I was able to create a LINQ statement that I thought was strange and
Why is it it gives error in return View(contacts.ToPagedList(pageNumber, pageSize)); statement the error in
I need a Linq statement that will select all from a table where a
I have a linq statement that returns a list of records based on where
I have a linq statement that searches a number of fields based on user
Given this xml document: <projects><project><name>sample project</name><location>http://somewhere.com/</location></project></projects> And this linq to xml statement for retrieving

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.