Reputation: 289
I am trying to understand the syntax of a LINQ query. I tried creating one to select all rows from my TRACK_INFO table where the column collegeOf was equal to a variable. My database name is KuPlan. Below is the query I tried to create and my TRACK_INFO model. The error i get is: "could not find an implementation of the query pattern for source type KU_PLAN_DEV.Models.TRACK_INFO. 'Where' not found."
controller:
var query = from degreeName in TRACK_INFO
where degreeName == trackButton
select degreeName;
model:
namespace KU_PLAN_DEV.Models
{
using System;
using System.Collections.Generic;
public partial class TRACK_INFO
{
public TRACK_INFO()
{
this.CORE_HEAD = new HashSet<CORE_HEAD>();
this.GEN_ED_HEAD = new HashSet<GEN_ED_HEAD>();
this.GEN_ED_NOTE = new HashSet<GEN_ED_NOTE>();
this.GRAD_CLEAR_HEAD = new HashSet<GRAD_CLEAR_HEAD>();
this.MAJOR_NOTE = new HashSet<MAJOR_NOTE>();
}
public string progNum { get; set; }
public string versionNum { get; set; }
public string degreeName { get; set; }
public string collegeOf { get; set; }
public string effectiveDateTerm { get; set; }
public Nullable<decimal> effectiveDateYear { get; set; }
public string trackDegreeType { get; set; }
public virtual ICollection<CORE_HEAD> CORE_HEAD { get; set; }
public virtual ICollection<GEN_ED_HEAD> GEN_ED_HEAD { get; set; }
public virtual ICollection<GEN_ED_NOTE> GEN_ED_NOTE { get; set; }
public virtual ICollection<GRAD_CLEAR_HEAD> GRAD_CLEAR_HEAD { get; set; }
public virtual GRAD_CLEAR_SIG_DATE GRAD_CLEAR_SIG_DATE { get; set; }
public virtual ICollection<MAJOR_NOTE> MAJOR_NOTE { get; set; }
}
}
Upvotes: 0
Views: 45
Reputation: 156459
TRACK_INFO
is a class name, not an IEnumerable<TRACK_INFO>
. I think you meant to get a property off of your context:
from degreeName in context.TRACK_INFO
...
Upvotes: 1