David
David

Reputation:

Can Entity Framework do what Linq To SQL does?

I'm a bit confused, I have worked with Linq To SQL and gather we can query anything in the dbml or entities e.g:

var query = from i in db.mytable
            select i;

But in the Entity Framework (which supposedly Microsoft are replacing Linq To SQL with) how can we do the same thing? Is it even possible? How does it replace Linq To SQL?

Would be grateful of any examples of the Entity Framework - i.e how the above is done in the Entity Framework! Thanks.

Upvotes: 2

Views: 457

Answers (2)

marc_s
marc_s

Reputation: 754230

Yes more or less the same - you have Linq-to-Entities, which should definitely support that simple LINQ query.

Entity Framework is much more than just a "bloated" Linq-to-SQL - see some points here.

This article shows quite nicely how to write Linq-to-Entities queries in your code.

Linq-to-Entities does not support the full Linq-to-SQL set of functionality for now, but EF4 (with .NET 4.0) is around the corner (should be released before the end of 2009, says Microsoft) and will bring massively more functionality and goodness to the EF space! Stay tuned.

Marc

Upvotes: 3

anishMarokey
anishMarokey

Reputation: 11397

The same thing only you want to write

var query = from i in db.mytable
            select i;

i think you are not created the object(db) properly for Entity Framework

LINQ To SQL Vs. Entity Framework

Upvotes: 2

Related Questions