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

  • Home
  • SEARCH
  • 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 5996863
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:10:59+00:00 2026-05-23T00:10:59+00:00

I have a code first model: namespace InternetComicsDatabase.Models { public class Issue { [Key]

  • 0

I have a code first model:

namespace InternetComicsDatabase.Models
{
    public class Issue
    {
        [Key]
        public int      IssueId     { get; set; }
        public int      Number      { get; set; }
        public string   Title       { get; set; }
        public DateTime Date        { get; set; }

        public virtual ICollection<Creator> Creators { get; set; }
    }

    public class Creator
    {
        [Key]
        public int      CreatorId   { get; set; }
        public string   FirstName   { get; set; }
        public string   MiddleName  { get; set; }
        public string   LastName    { get; set; }

        public virtual ICollection<Issue> Issues { get; set; }
    }

    public class Icbd : DbContext
    {
        public DbSet<Issue> Issues { get; set; }
        public DbSet<Creator> Creators { get; set; }
    }
}

In the controller, I am trying to load all the Creators that are associated with a particular issue:

    public string CreatorTest()
    {
        string output = "";
        var issue = db.Issues.Where(x => x.IssueId == 8);
        foreach (var item in issue.Creators)
            output += item.FirstName;
        return output;
    }

But this won’t compile… Why won’t this compile?

Specifically; the line that says:

        foreach (var item in issue.Creators)

won’t compile because of an error that says:

Error   1   'System.Linq.IQueryable<InternetComicsDatabase.Models.Issue>' does not contain a definition for 'Creators' and no extension method 'Creators' accepting a first argument of type 'System.Linq.IQueryable<InternetComicsDatabase.Models.Issue>' could be found (are you missing a using directive or an assembly reference?) C:\Users\dropstuff\asp.net mvc\InternetComicsDatabase\InternetComicsDatabase\Controllers\HomeController.cs  19  31  InternetComicsDatabase

What’s up with that? 🙂

I went back and doublechecked my controller (you can just scroll up) and, yep; there it is! Creators is a property of Issues. So what gives? Maybe it has something to do with lazy loading?

  • 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-23T00:11:00+00:00Added an answer on May 23, 2026 at 12:11 am

    Your query is wrong. You want:

    var issue = db.Issues.Where(x => x.IssueId == 8).Single();
    

    You are expecting a single issue, not a list of one issue.

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

Sidebar

Related Questions

I'm trying out Entity Framework Code first CTP4. Suppose I have: public class Parent
I have a requirement to make a large amount of code MISRA compliant. First
I have a code-first, POCO project in which I am trying to adjust an
I am creating a linq-to-sql model with EF, and have a class that works
First, the code: <UserControl x:Class=Engage.IWS.Modules.InteractionResults.Views.InteractionResultView xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml xmlns:mc=http://schemas.openxmlformats.org/markup-compatibility/2006 xmlns:i=clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity xmlns:cmd=clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras ... more here that
I have code that references a web service, and I'd like the address of
I have code to create another row (div with inputs) on a button click.
I have code similar to this filtering entries in an Array of Objects: var
I have code like this: var newMsg = new Msg { Var1 = var1,
I have code like this: template <typename T, typename U> struct MyStruct { T

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.