Shoham
Shoham

Reputation: 7304

Intellisense stopped working for Linq to Entities

I have this simple code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.Linq;
using GadNameSpace;


public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        GadEntities db = new GadEntities();
        var images = db.Images.Where(x => x.isApproved == true).ToList();

        Repeater1.DataSource = images;
        Repeater1.DataBind();
    }
}

Now if I'm trying to edit this line:

var images = db.Images.  <--this is where intellisense is not working...

It worked before. Same file, same project, same Solution. If I'm writing the code manually and run it, its working fine. I tried start > cmd > "devenv /ResetSettings" I tried to restart pc also. The problem is with Linq intellisense only! for anything else intellisense is working fine...

Any good ideas?

Upvotes: 1

Views: 3755

Answers (2)

DEV
DEV

Reputation: 37

Sometimes, reference of EntityFramework could be missing. Please make sure that the same exists in the project you're working on.

Upvotes: 2

Wiktor Zychla
Wiktor Zychla

Reputation: 48279

Usually this happens to me when a reference to System.Data.Linq.dll is missing from the module.

I bet you have your data context in yet another assembly where the reference is set correctly (so that the code works when you compile it) but in the same time the reference is missing from the web application (and thus VS does not show the intellisense).

Upvotes: 4

Related Questions