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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T21:22:22+00:00 2026-06-08T21:22:22+00:00

I’ve been searching all day and can’t find a solution to this… I have

  • 0

I’ve been searching all day and can’t find a solution to this…

I have an EntityCollection of Communication objects which each have an instance of an Intention object(one-to-one).

I also have a User object which has many instances of UserLocation EntityObjects(one-to-many)

  • Intention objects have a property UID.
  • UserLocation objects have a property LID.

  • I want to write a LINQ expression which returns all Communication objects where the UID property of the Intention instance associated to a Communication object equals ANY LID property of ANY instance of a UserLocation instance for a User object.

I’ve tried this

return _context.Communications.Where
(u => u.Intention.UID.Equals
(user.UserLocations.Select
(p => p.LID)));

and this

return _context.Communications.Where
(u => user.UserLocations.Any
(x => x.LID.Equals
(u.Intention.UID)));

and this

var thislist = from Intentions in _context.Intentions
                           join UserLocations in user.UserLocations
                           on Intentions.UID equals UserLocations.LID
                           select Intentions.UID;
            return _context.Communications.Where(u => u.Intention.Equals(thislist.Any()));

and this

var lidlist = user.UserLocations.Select(x => x.LID);
return _context.Communications.Where(x=> lidlist.Contains(x.Intention.UID)).ToList();

(this gives me an error on the Contains statement saying “Delegate System.Func<Communication,int,bool> does not take 1 argument”, don’t know how to fix)

Along with all these variations I have also:

  • modified my method to return IQueryable<Communication> and have also tried List<Communication> while appending ToList() to my queries.

Nothing works. Regardless of what I try I always end up with this exception

NotSupportedException was unhandled by user code

Unable to create a constant value of type ‘PreparisCore.BusinessEntities.UserLocation’. Only primitive types (‘such as Int32, String, and Guid’) are supported in this context.

What am i doing wrong??

  • 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-08T21:22:23+00:00Added an answer on June 8, 2026 at 9:22 pm

    Given this code:

    namespace CollectionsWithIntentions
    {
        using System.Collections.Generic;
        using System.Diagnostics;
        using System.Linq;
    
        internal class Program
        {
            #region Methods
    
            private static void Main(string[] args)
            {
                var communications = new[]
                    {
                        new Communication { Intention = new Intention { UID = 1 } },
                        new Communication { Intention = new Intention { UID = 2 } },
                        new Communication { Intention = new Intention { UID = 3 } },
                        new Communication { Intention = new Intention { UID = 4 } },
                    };
                var users = new[]
                    {
                        new User { UserLocations = new List<UserLocation>(new[] { new UserLocation { LID = 2 },new UserLocation{LID=5}  }) },
                        new User { UserLocations = new List<UserLocation>(new[] { new UserLocation { LID = 3 } }) }
                    };
    
                IEnumerable<Communication> res =
                    communications.Where(w => users.Any(a => a.UserLocations.Any(b=>b.LID == w.Intention.UID)));
                foreach (Communication communication in res)
                {
                    Trace.WriteLine(communication);
                }
            }
    
            #endregion
        }
    
        internal class Communication
        {
            #region Public Properties
    
            public Intention Intention { get; set; }
    
            #endregion
    
            #region Public Methods and Operators
    
            public override string ToString()
            {
                return string.Concat("Communication-> Intention:", this.Intention.UID);
            }
    
            #endregion
        }
    
        internal class Intention
        {
            #region Public Properties
    
            public int UID { get; set; }
    
            #endregion
        }
    
        internal class User
        {
            #region Public Properties
    
            public List<UserLocation> UserLocations { get; set; }
    
            #endregion
        }
    
        internal class UserLocation
        {
            #region Public Properties
    
            public int LID { get; set; }
    
            #endregion
        }
    }
    

    I get this result:

    Communication-> Intention:2
    Communication-> Intention:3
    

    Am I missing anything?

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a jquery bug and I've been looking for hours now, I can't
I have a text area in my form which accepts all possible characters from
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
Does anyone know how can I replace this 2 symbol below from the string
I have some data like this: 1 2 3 4 5 9 2 6
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example

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.