user161433
user161433

Reputation: 4519

How to access the Entity Framework

I have mapped the database in the edmx file from the database. Now how do I use linq to make a query?

here is an example of my problem

var Found = from o in ??????

What suppose to go in the question marks. How do I find what suppose to go in the question marks. I have tried many tutorials but that do not tell you exactly how to use Linq.

Upvotes: 0

Views: 100

Answers (1)

Muhammad Soliman
Muhammad Soliman

Reputation: 1176

Well, Entity Framework generates an ObjectContext for you. You should know the name of your ObjectContext class. Then to query using LINQ you can do something line that

using(var context = new NorthwindContext())
{
   var query = from p in context.ProductsSet select p;
   // then loop through your query instance.
}

The above example is very simple you should have a look at http://thedatafarm.com/blog/ for better tutorials

Upvotes: 5

Related Questions