user1240716
user1240716

Reputation: 1

Entity Framework slower than LinqToSql

I have 70.000 records in table. When i am trying to get all records with entityframework it nearly takes about 20 seconds. On the other hand when try to get all records with linqtosql it takes about 2 seconds. Why entityframework works too slower than linqtosql. Do i need to make any customization for entityframework to works faster.

Upvotes: 0

Views: 134

Answers (1)

Aducci
Aducci

Reputation: 26694

A more fair test would be to return an anonymous type in both queries and than compare the speeds. This way the resulting object from both linq-to-sql and entity-framework will be the same

For example:

var query = from x in context.Entity
            select new
            {
              x.Property1,
              x.Property2,
              .
              .
              .
            };

Upvotes: 1

Related Questions