Reputation: 89
My question looks simple to me but not getting it fixed. I am using EF 6 and LINQ to SQL in Visual Studio 2013. I want to fetch a record from second table on behalf of foreign key being used in first table. I wanted to use 'Include' function but 'Include' function neither show table names in IntelliSense nor accepts in a lambda expression like this:
var record= db.tblChild.Include(x=>x.tblParent)
My original code shows the libraries added.
Upvotes: 1
Views: 3721
Reputation: 111
You only need to add:
using System.Data.Entity;
Into your Namespace.
Upvotes: -1
Reputation: 8466
In order to use lambdas in Include you have to import the System.Data.Entity namespace (which you have) and also reference EntityFramework.dll which includes the necessary extension methods.
Upvotes: 5