Skip to content

CSharp-Pills-15mg/Queryable-vs-Enumerable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Queryable vs Enumerable

Pill Category

Frameworks (Entity Framework)

Description

Known fact: DbSet is IQueriable

  • In Entity Framework, the DBSet class implements IQueriable interface. So, all the Linq queries that we write are applied on an IQueriable object.

Cast IQueriable to IEnumerable

  • But, what happens if we cast this IQueriable to IEnumerable and then apply the same Linq query?

Question

  • How is the execution affected if we cast the IQueryable to IEnumerable before applying that Linq query?

Donations

If you like my work and want to support me, you can buy me a coffee:

ko-fi

About

A C# Pill that highlights that the Linq query applied after a cast to `IEnumerable` is not translated into SQL. Instead, it is run in memory.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

Languages