Home

Include() extension method is not found

I am able to do
var result =  OAS_Questions.Count (oasq => oasq.Id!=0);
result.Dump();
and even
var result =  OAS_Questions;
result.Dump();
But when I try to include child objects of "Questions" say "Opitons" through
var result =  OAS_Questions.Include("OAS_QuestionOptions");
result.Dump();
I am shown the below error
'System.Data.Linq.Table<LINQPad.User.OAS_Questions>' does not contain a definition for 'Include' and no extension method 'Include' accepting a first argument of type 'System.Data.Linq.Table<LINQPad.User.OAS_Questions>' could be found (press F4 to add a using directive or assembly reference)

I have referred the below assembly references:
System.Data
System.Data.Entity
System.Data.Linq

But still the extension method "Include()" is not available while composing query.

Comments

  • edited February 2013
    Go to Query Properties and in 'Additional Namespaces', include System.Data.Objects

    Also, I take it that you're connecting to a custom Entity Framework context? The Include method is not supported with LINQ to SQL.
Sign In or Register to comment.