C# Why Expression Trees Are Cool (Entity Framework)

Sdílet
Vložit
  • čas přidán 2. 07. 2013
  • Come now, let us reason together. You see, this query can execute more efficiently on the database instead of bringing all the data into our local process space.

Komentáře • 29

  • @JorgePicco
    @JorgePicco Před 9 lety +9

    It's funny how a good explanation makes things seem very simple. Thank you Jaime.

    • @akab211
      @akab211 Před 3 lety

      Because they are simple...

  • @vishalpadte9297
    @vishalpadte9297 Před 3 lety

    Perfectly explained. Totally happy

  • @fadidib8516
    @fadidib8516 Před 2 lety

    after 8 years this is the best guy explaining EF

  • @davidmata3104
    @davidmata3104 Před 4 lety +1

    This is awesome, you make very easy to understand the difference between Expression and Func

  • @sasdude1
    @sasdude1 Před 5 lety +2

    Great Explanation!! I have to say you are one best c# teachers on youtube :)

  • @vaqifqurbanov3112
    @vaqifqurbanov3112 Před 2 lety

    Thank you for your lessons

  • @EG-xm7tx
    @EG-xm7tx Před 8 lety +1

    This playlist was really great...a lot of my concepts got clear, :) Thank you very much Jamie.

  • @MohammedNoureldin
    @MohammedNoureldin Před 7 lety +1

    Brilliant video specifically and brilliant series generally sir! thank you very much!

  • @KDOERAK
    @KDOERAK Před 7 lety +1

    Another great video. Thank you very much!

  • @amdreallyfast
    @amdreallyfast Před 5 lety +2

    Relevant 2019. I'm trying to understand lambdas, expressions, EF, and moq's templated expression lambda madness, and now it's all coming together!

  • @saiabhirambandhakavi1188

    This is a good video. Makes the whole concept of Lambdas, Expressions and IQueryable and IEnumerable easier to understand.

  • @rusnakviktor1580
    @rusnakviktor1580 Před 9 lety +2

    Great video! Thanks!

  • @jmbrjmbr2397
    @jmbrjmbr2397 Před 2 lety

    Phenomenal lessons, thank you so much!

  • @mohitshah8839
    @mohitshah8839 Před 8 lety +1

    Great lecture thanks man

  • @Beitouzi
    @Beitouzi Před 6 lety +1

    Awesome!

  • @behnamrasooli8801
    @behnamrasooli8801 Před 6 lety

    This is useful to know if you are receiving that lambda as an argument of a function and then you're constructing your entity framework query inside that function.
    For example:
    public IEnumerable LoadMyEntities(Func predicate)
    {
    return Context.MyEntities.Where(predicate);
    }
    This cold will retrieve all the dataset from database and filter the result in the application side. Because in this cace, your predicate parameter is an IEnumerable. Now if we change the code a bit like this:
    IEnumerable LoadMyEntities(Expression predicate)
    {
    return Context.MyEntities.Where(predicate);
    }
    This version filters the result in the database side, so it will be faster. Because in this second case, your predicate parameter is an IQueryable. I'm not saying the first version is bad or less performant, it has its place and it depends on your scenario. For example, Entity framework caches the loaded data, so if your dataset is not very big and you're running queries on it a lot of time, it makes sense to cache the dataset and do the filtering in the application side rather than calling the database each time.

  • @yashnarwal2314
    @yashnarwal2314 Před 9 lety +1

    was good one :)

  • @mhmdelbasmy6290
    @mhmdelbasmy6290 Před 8 lety +2

    Thank you very much .. (Y)

  • @abdelnabiissam9310
    @abdelnabiissam9310 Před 5 lety +2

    as name implies Jamie The King :)

  • @alanextar
    @alanextar Před 4 lety

    Thanks for a good introduction. What does the "[Extent1]" mean? I think that it is a variable which stores table name, where is the value stored? How entity framework sends data? Is it serialized as bytes or what? And final question, what is the practical usage of expression tree despite of knowing how it is passed?

    • @alanextar
      @alanextar Před 4 lety

      Ok. I found that [Extent1] was set in "From [dbo].People as [Extent1]" part of query. But what is the practical usage of exp tree concerning entity framework especially?

  • @HackerIsreali
    @HackerIsreali Před 2 lety

    where its the previous code?

  • @jasonlokismith
    @jasonlokismith Před 10 lety

    Hi Jamie, what application are you using to create notes over any window? I like the way you create the videos with this cool app? is it a free download?

  • @kubanychbekazhymbekov2660

    Where is expression man?

  • @angel_machariel
    @angel_machariel Před 8 lety

    I don't understand the purpose of this video at all. What's the point of
    IEnumerable in this context when the expression is ignored by SQL
    server? What message does this video convey at all?
    As of the 10:30 mark (around) the video completely lost me. What was the console output? With or without the filter? If it is filtered, then why ull ALL data and then filter in code? It's very database unfriendly. All in all, I don't get it all.

    • @hanahori
      @hanahori Před 8 lety +4

      +A Freethinker The point is to show you that IQueryable.Where (which operations on expressions and not delegates like IEnumerable.Where) translates the expressions into SQL. You would not want to convert an IQueryable to IEnumerable before filtering for the reason you provided, it's database unfriendly. The primary point is to reinforce the nature in which EntityFramework works with Expression Trees to translate them to SQL and return them as an enumerable set of data.

    • @angel_machariel
      @angel_machariel Před 8 lety

      hanahori
      Aaaaaaaaaaaaaah!
      Thanks man!