abdul.badru
abdul.badru

Reputation: 531

What is the difference between LINQ to SQL and LINQ to Entities?

Normally when I use Entity Framework it is usual to use queries like the one below to query database tables.

var query = from persons in dbcontext.Person
where gender==1
select persons;

This is a LINQ to SQL or LINQ to entity?

Upvotes: 0

Views: 2486

Answers (1)

Slauma
Slauma

Reputation: 177133

When you use Entity Framework as your Object Relational Mapper (ORM) the correct terminus technicus for a LINQ query against EF - that means, a LINQ query that uses an EF context set (DbSet or ObjectSet, like dbcontext.Person in your example) as its initial source - is LINQ to Entities.

LINQ to SQL is the name for another ORM (also from Microsoft, a bit older than EF and not in active development anymore, "retired" so to speak). I'm honestly not sure if LINQ queries against a LINQ to SQL context are also called "LINQ to SQL".

Anyway, since you use EF, "LINQ to Entities" is probably always the correct term. Don't use the "linq-to-sql" tag here on Stack Overflow for questions about EF because this tag is reserved for questions about that older ORM mentioned above.

Upvotes: 2

Related Questions