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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:14:23+00:00 2026-06-16T00:14:23+00:00

I have the code snippet below which generates an error at i.tPersons.Any as: ‘WhatWorks.Models.tPerson’

  • 0

I have the code snippet below which generates an error at “i.tPersons.Any” as:

‘WhatWorks.Models.tPerson’ does not contain a definition for ‘Any’ and no extension method ‘Any’ accepting a first argument of type ‘WhatWorks.Models.tPerson’ could be found (are you missing a using directive or an assembly reference?)

‘Any’ is a method of System.Data.Entity so I would expect this to be picked up. What am I missing?

using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using WhatWorks.Models;

namespace WhatWorks.Controllers
{
    public class InterventionController : Controller
    {
        private WhatWorksEntities db = new WhatWorksEntities();

        //
        // GET: /Intervention/

        // where parameter list only includes id
        public ActionResult Index(int id)
        {
            var model =
                    (
                        from i in db.tInterventions
                        where (i.householdID == id && !(i.tPersons.Any(t => i.householdID == id)))
                        select i
                    );
  • 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-16T00:14:24+00:00Added an answer on June 16, 2026 at 12:14 am

    Any() is a Linq extension method that can be applied to IEnumerables and IQueryables.

    It looks like you are executing .Any() on the tPersons collection but in the Predicate for Any you are using ‘i’ which is in your case an instance of tInterventions.

    So, either replace the i in i.householdID with t.householdID or execute Any on tIntervensions directly.

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

Sidebar

Related Questions

I have below snippet of code in which TestClass is extending jPanel which is
I have stumbled upon the following problem. The below code snippet does not link
Below is the code snippet with comments which describes the problem statement. We have
I have a sample code snippet below which works just fine (I trimmed the
I have found a code snippet as given below which is used to disable
I have the code snippet below in C++ which basically calculates the pi using
I have a code snippet as below <CheckBox Name=cb Margin=1,2,1,0 IsChecked={Binding Path=IsManager} IsEnabled=True/> Consider
I have below code snippet SimpleDateFormat dateFormat = new SimpleDateFormat( yyyy-MM-dd hh:mm:ss.SSS); String processedContentDate=2012-04-10
I have this snippet of code below. I want to pass the value of
Below is the snippet of my code. I have a JTable. I have extended

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.