Entity Framework Core Part 4 - Eager vs Lazy Loading

Sdílet
Vložit
  • čas přidán 8. 10. 2020
  • Are you eager to learn about lazy loading, or lazy when it comes to eager loading? Here we'll compare the option Entity Framework Core has to offer.
    Source code available at: github.com/JasperKent/Entity-...
  • Věda a technologie

Komentáře • 38

  • @CodingTutorialsAreGo
    @CodingTutorialsAreGo  Před 3 lety +2

    Coming up, we've got configuration and migration, but let me know what else you'd like to see on EF Core.
    Source code is at github.com/JasperKent/Entity-Framework-Lazy-Loading
    Don't miss the next exciting episode. Subscribe at: czcams.com/channels/qWQzlUDdllnLmtgfSgYTCA.html

  • @paulolopes9764
    @paulolopes9764 Před 3 lety +12

    I just won the day when I discovered your channel ;)
    In just 3 or 4 short videos, I've learned more than in some intensive tutorials lasting hours and hours...
    Congratulations and thank you so much for sharing your precious knowledge so clearly and straight to the point.
    From now on I will be checking out your excellent work regularly, and I will certainly recommend your channel to my colleagues.
    Once again I am really grateful for your generous altruism!
    Cheers from Portugal.

  • @roiram3286
    @roiram3286 Před rokem +2

    all your videos are great. Thank you

  • @francescopaoloribaudo3384

    I have seen several videos on efc made by others but no one has ever talked about these particular issues that are essentials for programmers.
    Happy to have discovered you, Thank's a lot!

  • @legion4929
    @legion4929 Před 2 lety +1

    this is one of the best Ef tutorials i have ever seen thank you sir for you videos

  • @user-ic2uv7ls4h
    @user-ic2uv7ls4h Před 2 lety +2

    Great video! Just started to play around with EF and I couldn't wrap my head around the concepts of eager and lazy loading. Thanks for such explanation.

  • @piotrchoma3864
    @piotrchoma3864 Před 2 lety +2

    I'm new in EF and your videos are huge help for me. Thank you a lot. As quality content as yours should have many more viewers.

  • @abhijoydas4478
    @abhijoydas4478 Před 3 lety +3

    Amazing Work. This is one of the well explained content, that digs deep and at the same time keeps it simple.

  • @johnyw1049
    @johnyw1049 Před 2 lety +1

    ty man. I love you and your tutorials . GJ

  • @ajonescouk
    @ajonescouk Před 3 lety +4

    Amazing thank you! I have a relatively big C# desktop application but coding isn't my day job and I'm currently hitting problems with this. I was using explicit loading and wasn't always ending up with the data loading fully.
    I need to refactor and tidy the backend anyway but I'm certain that in my case lazy loading will be the solution. Very clearly explained thank you. Not sure why you have so few subs so far but you have one more now 😊
    EDIT: and yes, my data structures are complex enough that using eager loading every time would be *ridiculous*.

  • @ghostslinger3148
    @ghostslinger3148 Před 2 lety +1

    Thank you for the great explanation!
    I've been having troubles with Lazy loading, seems like I should go with Eager loading instead.

  • @adambelos6129
    @adambelos6129 Před 3 lety +1

    How is that posible that i always get recomended from youtube some random indian guy from which i dont learn anything? This guy is underated genius. Hilarious video please keep it up :) your video actualy teached me a huge amount of useful information per just few minutes. Thank you sir. And please please keep it up. :)

  • @victortavares8181
    @victortavares8181 Před 2 lety +1

    Awesome explanation, solved me a problem. Thank you so much!

  • @joelnelson9196
    @joelnelson9196 Před 2 lety +2

    Thank you very much for this content. Very helpful.

  • @oncalldev
    @oncalldev Před 2 lety +1

    Great explanation. Very clear.

  • @adamnorman85
    @adamnorman85 Před 3 lety +1

    practical , understandable, comprehensive detailed Thanks Don keep on

  • @hanh.trinh.yeu.thuong
    @hanh.trinh.yeu.thuong Před 2 lety +1

    It's very useful! Thank you!!!

  • @ravendevinci5760
    @ravendevinci5760 Před 2 lety +1

    Amazing video thank you. Keep going :D

  • @michaelwright8576
    @michaelwright8576 Před 2 lety +1

    Great video! thank you.

  • @wf808
    @wf808 Před rokem

    Wow thank you so much!

  • @dmitriusold8084
    @dmitriusold8084 Před rokem +2

    Thanks for interesting video!!! But why do we use SQLite throught whole course, why don't MSSQL or MySQL?

    • @CodingTutorialsAreGo
      @CodingTutorialsAreGo  Před rokem +1

      One of the key points of Entity Framework is that it works the same way, regardless of database, as long as the feature in question is supported by the database. SQLite just seems easiest, as it doesn't need any additional installation. But I use MSSQL sometimes.

    • @dmitriusold8084
      @dmitriusold8084 Před rokem +1

      @@CodingTutorialsAreGo All right! Thanks!

  • @piotrjan2927
    @piotrjan2927 Před 2 lety

    If AutoMapper with ProjectTo() LINQ extension method is used... and if the actual mapping involves getting data from related tables/entities (via ForMember() method, for example)... then how does it mesh with EF loading modes? Which method of loading related data is used by EF under the hood?
    Thanks.

  • @davidwhite2011
    @davidwhite2011 Před 3 lety +1

    So is there any difference in using a loop and .take to batch out queries to more manageable sizes in core than EF6? Does using async methods change that?

    • @CodingTutorialsAreGo
      @CodingTutorialsAreGo  Před 3 lety

      Thanks for the question. I don't know of any differences in that area between EFCore and EF6. However, you're right about async, particularly with the new IAsyncEnumerable in C#8. This video covers it: czcams.com/video/TWBqRA3s--M/video.html. Doesn't use EF, but you can imagine putting whatever you like in the middle of the loop.

    • @davidwhite2011
      @davidwhite2011 Před 3 lety +1

      @@CodingTutorialsAreGo Seems like a test using something like Brian Chavez 's Bogus to fill up a faux data base and then see how performance works in different scenarios and how to handle it. Maybe that would make a good video on speed? BenchmarkDotNet to test the speed.

  • @florent9555
    @florent9555 Před 2 lety +1

    What if you have self referencing tables which you cannot know the depth. For example you can have an object inside an object inside an object and so on. If the depth of this is user defined I cannot imagine how this would be achievable with eager loading. Loading an unknown amount of nested objects would be I think way to complicated and has to be done recursively which is also not that performant

    • @CodingTutorialsAreGo
      @CodingTutorialsAreGo  Před 2 lety

      Great question. I've hit that problem myself, using the composite pattern. As far as I know, if you're doing eager loading, you have to be explicit about how many levels you go down. Otherwise, it would be possible to accidently pull in vast amounts of data. What I do is use eager loading to a depth that I think is a reasonable guess, and then also have lazy loading (or possibly explicit loading) to catch those rare, extra-deep cases.

    • @florent9555
      @florent9555 Před 2 lety

      @@CodingTutorialsAreGo Ok so you can basically specify the depth for eager loading? Can you do this in EF core?

    • @CodingTutorialsAreGo
      @CodingTutorialsAreGo  Před 2 lety +3

      @@florent9555 Yes, you do something like
      context.rootSet
      .Include (rs => rs.Children)
      .ThenInclude (c => c.Children)
      .ThenInclude (cc => cc.Children);
      chaining as many 'ThenInclude's as you want.

  • @shubhamgujare7912
    @shubhamgujare7912 Před 5 měsíci

    Hey good video, but can you explain the stuff little slow. We all are new to this.

  • @robotsturm6488
    @robotsturm6488 Před 11 měsíci

    Ok, no abuse lazy loading is good