Chris James
Chris James

Reputation: 11711

LINQ Table does not contain a definition for count (or any other Queryable extension methods)

We are changing some legacy code to use LINQ to SQL.

In a seperate test throwaway class I tried making my db context and I can do

mydbcontext.mytable.Count()

fine, and it's all intellisensed.

However, when trying to implement this in the class (which is in the same assembly), the Queryable methods, such as Count, Where, etc are no longer valid.

Any ideas why this would be?

Upvotes: 0

Views: 721

Answers (1)

cadrell0
cadrell0

Reputation: 17307

make sure you have using System.Linq;

Upvotes: 8

Related Questions