Query for Entity Framework using Concept of Projection for Tuned Performance.

Hi Kids,

You should not filter your entity framework results with-in a loop.

It is better to code it like this.

var object = await db.Tables.Include(o => o.AnotherTable)
.Where(s => s.Created >= startDate && s.Created <= endDate)
.OrderByDescending(lambda => lambda.id)
.Select(anotherlambda => new TemporaryObject{
                        SelectedColumn = so.SelectedColumn ,

Do I have to tell you everything?

It's only fair to share...Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

Leave a Reply

Your email address will not be published. Required fields are marked *