ASP.NET Core Web API + Entity Framework Core : Loading Related Data | Eager Loading - EP04

แชร์
ฝัง
  • เผยแพร่เมื่อ 24 ธ.ค. 2024

ความคิดเห็น • 89

  • @CuriousDrive
    @CuriousDrive  4 ปีที่แล้ว +3

    Code - github.com/CuriousDrive/BookStores
    Thanks for watching, please share with your friends :)

  • @programmingpersistence5716
    @programmingpersistence5716 ปีที่แล้ว

    Thank you. I feel like tutorials such as this should not be overlooked, understanding these concepts can save alot of time and make dev easier

  • @waqasriaz30
    @waqasriaz30 3 ปีที่แล้ว +1

    I wish I had an option to press this 'Like' button more than once. I don't feel time passing when hearing this guy calmly giving lesson. Smooth as butter. !

    • @CuriousDrive
      @CuriousDrive  3 ปีที่แล้ว

      Thanks for a lovely comment Waqas. Please share with your friends. :)

  • @justicefreeman6598
    @justicefreeman6598 3 ปีที่แล้ว +1

    I HAVE BEEN SEARCHING FOR IT 3 DAYS, DAMN! YOU'RE A GOD!
    Seriously, why even Microsoft can't normally show how it needs to be done. I understand that you don't necessarily need related data, but at least show me the way how to do it, Microsoft! And not only MS but other TH-cam teachers only use some simple model without relationships. That's a very helpful, I love you!

    • @CuriousDrive
      @CuriousDrive  3 ปีที่แล้ว +2

      Thanks for watching Adilet. I am glad that you found this helpful.

  • @2good4you76
    @2good4you76 5 ปีที่แล้ว +4

    Thank you!
    I needed exactly what you were doing and now I also understand ASP.NET Core.
    Really nice english and a perfect tutorial, well done!

  • @gerardoivan1764
    @gerardoivan1764 4 ปีที่แล้ว +1

    Hello, do you know why it only retrieves one book and no users?

  • @jesusalvarez9733
    @jesusalvarez9733 3 ปีที่แล้ว +1

    Thanks! i have a question, is possible to add a filter to the included table

    • @CuriousDrive
      @CuriousDrive  3 ปีที่แล้ว +1

      Yes you can use LINQ method Where() to filter data.
      docs.microsoft.com/en-us/ef/core/querying/#filtering

    • @jesusalvarez9733
      @jesusalvarez9733 3 ปีที่แล้ว

      @@CuriousDrive Thanks for the link!

  • @pylvr8021
    @pylvr8021 2 ปีที่แล้ว +1

    Can you help with this please.
    I want to prevent EF from getting those circular dependency not only ignoring them in the json results . That because im experiencing some performance issues

    • @CuriousDrive
      @CuriousDrive  2 ปีที่แล้ว

      "Circular Dependency" does not let you build the solution. Is your solution getting built? Please check below link if you are facing performance issues. I should just make a video about it.
      docs.microsoft.com/en-us/ef/core/performance/

  • @hrishikeshgarud7177
    @hrishikeshgarud7177 3 ปีที่แล้ว +1

    Does Books related to publisher means pub_id in Book is a foreign key to pub_id in Publisher? I am beginner to SQL.

    • @CuriousDrive
      @CuriousDrive  3 ปีที่แล้ว +1

      Yes you correct Hrishikesh.

  • @TheMubeenyou
    @TheMubeenyou 4 ปีที่แล้ว +1

    Best ASP.Net Core Tutorial Ever, Very Fluent Explanation.

    • @CuriousDrive
      @CuriousDrive  4 ปีที่แล้ว +1

      Thanks for the lovely comment Adbul. Please share with others.

    • @TheMubeenyou
      @TheMubeenyou 4 ปีที่แล้ว

      @@CuriousDrive Most Welcom3

  • @cooperx2917
    @cooperx2917 2 ปีที่แล้ว

    What’s the best way to model EF related models in create action in mvc?
    My model state is always false because EF has sent related data to the view

  • @WhosAmaaazed
    @WhosAmaaazed 11 หลายเดือนก่อน

    Just a heads up, if you're working on latest .NET versions and you still get the json error, the " .SetCompatibilityVersion(CompatibilityVersion.Version_3_0)" is obsolete, so would need to remove ONLY that line.

  • @ajaymanagaon
    @ajaymanagaon 2 ปีที่แล้ว

    When there is a Null entry in the Books table, then it will throw an exception. How to resolve this?

  • @pabli77o77
    @pabli77o77 4 ปีที่แล้ว +2

    Hello! First of all I want to tell you that the videos are great and the explanation is very clear, thanks for that!
    But when running the application it cannot find the path "api/Publishers/GetPublisherDetails/1" and the Firefox console shows me the following error: "The character encoding of the plain text document was not declared. The document will be seen with garbage in the text in some browser settings does contain characters outside the US-ASCII range. Character encoding needs to be declared in the transfer protocol or the file needs to use a byte order mark as the encoding signature.".
    Do you have any idea how I can solve it?

    • @CuriousDrive
      @CuriousDrive  4 ปีที่แล้ว

      Thanks for the kind words :)
      I have never faced this, so I googled about it. It looks like your route is not correct. Please check out this article.
      stackoverflow.com/questions/53252358/web-api-asp-core-the-character-encoding-of-the-plain-text-document-was-not-decl

  • @reddeimon475
    @reddeimon475 3 ปีที่แล้ว +1

    hello, can you make a tutorial of how to call Stored Procedure that join tables without any keys in Entity Framework? I am able to call the procedure but it does not include any other joined tables, much appreciated

    • @CuriousDrive
      @CuriousDrive  3 ปีที่แล้ว

      Yes, that's the plan. I am working on a EF Core .NET5 course right now. calling complex stored procedure is one the episode for the series.

  • @virajdoshi
    @virajdoshi 4 ปีที่แล้ว

    can you share a linq to entity query which basically returns all details of books and the author name from author table ? (consider one book has only one author and there are models cerated for books and authors in webapi. In SQL world, this would be a really very easy inner join between books table and authors table and we could select all columns from books and "authorname" column from author table but i am somehow really not able to do this in linq to entities and not able to return the model of books . My books model has authorid as a property and another property of type author (author model) - as 1 to 1 relationship.
    Thanks

  • @mughees1965
    @mughees1965 2 ปีที่แล้ว

    How your program ran without using builder.Configuration.GetConnectionString ?

  • @vaishalinarayan2919
    @vaishalinarayan2919 4 ปีที่แล้ว +1

    Great Series!! Thanks a ton.
    Is there any way to return multiple datasets from stored procedure using FromSqlRaw in EF Core?

    • @CuriousDrive
      @CuriousDrive  4 ปีที่แล้ว +1

      Hi Vaishali, I am glad that you are finding the series helpful.
      In MS docs did not find any place where we can get multiple datasets as FromSQLRaw. FromSQLRaw is a method of datasets so I am not sure it's possible. I know it sucks. I consider this as one the cons of using EF Core. Please check below reference. Good question!!!
      docs.microsoft.com/en-us/ef/core/querying/raw-sql#basic-raw-sql-queries

    • @vaishalinarayan2919
      @vaishalinarayan2919 4 ปีที่แล้ว

      Thanks for replying. I have to switch to dapper unfortunately as our business logic is in stored procedures. And dapper has dapper contrib extension which could be used for CRUD. Thanks again for the videos, really useful and simple to understand. You saved so much of effort to google and learn as ASP.NET Core, EF is so vast.

    • @CuriousDrive
      @CuriousDrive  4 ปีที่แล้ว +1

      You are welcome Vaishali.
      I have heard good things about Dapper. Best of luck for your project. Thanks for watching!!!

  • @talkathiriify
    @talkathiriify 5 ปีที่แล้ว +2

    Thank you for restructuring the Episodes.

    • @CuriousDrive
      @CuriousDrive  5 ปีที่แล้ว +2

      Thanks Tarik, I was going to talk to you yesterday that I am going to make authentication related demo for #blazor after couple of asp.net + ef core demos.
      The reason why I am doing this is because most of the authentication code is written on the API side.
      So I am preparing the API

    • @talkathiriify
      @talkathiriify 5 ปีที่แล้ว +1

      Hi Fahad, That is excellent I hope you a good luck in your series.
      Thank you very much indeed.

  • @oj2555
    @oj2555 3 ปีที่แล้ว +1

    Great video but after downloading project files and setting up keep getting "No connection could be made because the target machine actively refused it" error when trying to login.
    Can't resolve, and would love to continue with the rest of the videos.

    • @CuriousDrive
      @CuriousDrive  3 ปีที่แล้ว

      Hello OJ, have you setup the database before running the project. There's a script in the source code which will generate the database tables.

    • @oj2555
      @oj2555 3 ปีที่แล้ว +1

      @@CuriousDrive Hi Thanks for the reply, I had multiple versions of sql express installed which messed with the connection strings now up and running and enjoying the videos.

    • @CuriousDrive
      @CuriousDrive  3 ปีที่แล้ว

      @@oj2555 Glad to hear that you were able to resolve the issue.

  • @bridgerwinter6783
    @bridgerwinter6783 3 ปีที่แล้ว +1

    bruh ur literally a god

    • @CuriousDrive
      @CuriousDrive  3 ปีที่แล้ว +1

      Gods love using Entity Framework Core.

  • @jamesarielpates6054
    @jamesarielpates6054 4 ปีที่แล้ว

    i don't really get it when you do this [ var publisher = _context.Publishers.Where(pub => pub.PubId == id).FirstOrDefault(); ] where did that "pub" came from, please enlighten me thank you :-D

    • @CuriousDrive
      @CuriousDrive  4 ปีที่แล้ว +1

      Lol. I am using LINQ there. C# LINQ is used to make the query in EF Core. I suggest you to go through this below article to understand what LINQ is and how it could be used.
      www.tutorialsteacher.com/linq/what-is-linq

  • @satvirkambo1506
    @satvirkambo1506 4 ปีที่แล้ว +2

    Dude, These tutorials are awesome! Thank you so much.

    • @CuriousDrive
      @CuriousDrive  4 ปีที่แล้ว +1

      Thanks for the kind words. Please share with others.

  • @kandinagireddy
    @kandinagireddy ปีที่แล้ว

    Tutorial is very good. Are there any new series on .Net 6/7/8/ Web api??

  • @manipathak4296
    @manipathak4296 4 ปีที่แล้ว

    Hello, if our database is not related is it possible to use include?

    • @CuriousDrive
      @CuriousDrive  4 ปีที่แล้ว +1

      I think it's possible but you will have to override some functionalities from DbContext and Models. Found this article where they are experimenting with the idea
      livebook.manning.com/book/entity-framework-core-in-action/chapter-6/v-8/81
      Good question by the way, definitely made me think a lot.

    • @manipathak4296
      @manipathak4296 4 ปีที่แล้ว

      @@CuriousDrive will try it man! After reading the same.

  • @shubhamvishwakarma2198
    @shubhamvishwakarma2198 3 ปีที่แล้ว +1

    Thank you very much Sir!!!
    I was facing the same issue. And all other solutions were confusing.
    Thanks for making it so simple

    • @CuriousDrive
      @CuriousDrive  3 ปีที่แล้ว

      I am glad the video was helpful. Thanks for watching Shubham.

  • @talkathiriify
    @talkathiriify 5 ปีที่แล้ว +2

    Great job brother!
    You are a supper please keep going on.
    Thank you very much

  • @tuseroni6085
    @tuseroni6085 ปีที่แล้ว

    i want them to implement something like laravel has where i can specify which related entities should be automatically loaded any time so i don't have to keep specifying the whole tree i want.

  • @eliezerjimenez1540
    @eliezerjimenez1540 3 ปีที่แล้ว +1

    Thank you friend, It's amazing your explain.

    • @CuriousDrive
      @CuriousDrive  3 ปีที่แล้ว

      Thanks for watching the video Eliezer. Please share with others :)

  • @mouradaissani8957
    @mouradaissani8957 4 ปีที่แล้ว

    thank you alot ; but at 5:40; its better to remove "services.AddControllers" (since we added services.AddMvc..) and also remove "setCompatibilityVersion" since the project is targeting 3.1

    • @CuriousDrive
      @CuriousDrive  4 ปีที่แล้ว +1

      Thanks for the feedback. I will make changes in the GitHub Repo.

    • @mouradaissani8957
      @mouradaissani8957 4 ปีที่แล้ว

      @@CuriousDrive welcome

    • @mouradaissani8957
      @mouradaissani8957 4 ปีที่แล้ว

      thank you again about the great content you sharing here

  • @nurwantoade5002
    @nurwantoade5002 4 ปีที่แล้ว

    hmmm user not have relation to job? i get error

    • @CuriousDrive
      @CuriousDrive  4 ปีที่แล้ว

      that's because in the future we are using "Role" table to figure out jobs of the users.
      I am using "Role" table to explain authorization and authentication in the front end which is written in Blazor.

  • @stevenwang1374
    @stevenwang1374 3 ปีที่แล้ว

    Great video, thanks from new zealand

    • @CuriousDrive
      @CuriousDrive  3 ปีที่แล้ว

      Hello from USA. Thanks for watching :)

  • @CAPS_AMERICA
    @CAPS_AMERICA 2 ปีที่แล้ว +1

    Hi man, thanks for the great tutorial series, my I suggest, if you don't have it yet, that you create a full core API with authentication tutorial but with the proper project structure , folders and classes? Basically something like n-tier like structure so it could be closer to a real-world production API, then a simple code to consume those APIs? Thanks bro.

    • @CuriousDrive
      @CuriousDrive  2 ปีที่แล้ว

      Hello Jack, this video is part of the series that you are looking for. Please check the full playlist below and let me know if anything particular is missing in this series, I would be very happy to make that video.
      th-cam.com/video/CLVJVA9cTuU/w-d-xo.html

  • @klearner666
    @klearner666 2 ปีที่แล้ว

    Hey first of I'd like to thank you for such a wonderful video series you really explain well.
    I need help on creating a dynamic menu.
    Where a parent may have n number of children in such case what is best way to fetch the data.
    I have model with menu containing ICollection.
    Can you please help me here I don't find any good tutorial on making dynamic menu.
    Thank you

  • @narayanant8489
    @narayanant8489 5 ปีที่แล้ว +3

    Hi Brother,
    Eagerly waiting for the implementation of Audit trail using EF Core. Thanks in Advance.

    • @CuriousDrive
      @CuriousDrive  5 ปีที่แล้ว +3

      Yes. It wasn't on my horizon but I will make for you. Thanks for the idea

  • @amitkishor9896
    @amitkishor9896 3 ปีที่แล้ว

    hello sir how to use stored procedure when I use database first plz make a video

    • @CuriousDrive
      @CuriousDrive  3 ปีที่แล้ว +1

      Hello Amit, I have plans to make a video series on ASP.NET Web API for .NET 5 framework. I am going to cover how you can call stored procedure in that series but meanwhile you can take a look at this article. I hope this helps.
      www.entityframeworktutorial.net/efcore/working-with-stored-procedure-in-ef-core.aspx

    • @amitkishor9896
      @amitkishor9896 3 ปีที่แล้ว

      @@CuriousDrive ok sir I am waiting for your API video series

  • @WikkiOnIlluminati
    @WikkiOnIlluminati 4 ปีที่แล้ว +2

    AWESOME AWESOME
    CAN I INCLUDE DATA IN PAGINATED MANNER??
    CAN YOU SHOW THAT PART

    • @CuriousDrive
      @CuriousDrive  4 ปีที่แล้ว

      WikkiOnIlluminati, I did not add that in the scope of this series. But when I start a new series on .NET 5 Web API then I can show in one of the demos. Thanks for the suggestion.

  • @leethai98
    @leethai98 3 ปีที่แล้ว

    Thank you so much. Amazing good job!!!!

    • @CuriousDrive
      @CuriousDrive  3 ปีที่แล้ว +1

      Thanks for watching. Please share with your friends :)

  • @frank7dev312
    @frank7dev312 4 ปีที่แล้ว

    thanks friend, this is exactly what i was looking for, cheers :D .

    • @CuriousDrive
      @CuriousDrive  4 ปีที่แล้ว

      I am glad that it worked for you. Please subscribe and share the videos with your friends.

  • @capptenjenny2794
    @capptenjenny2794 4 ปีที่แล้ว +1

    from VietNam
    thank you for help me.

    • @CuriousDrive
      @CuriousDrive  4 ปีที่แล้ว +1

      Welcome to Curious Drive. Thanks for watching the video.

  • @khalilkhalaf8182
    @khalilkhalaf8182 5 ปีที่แล้ว +2

    good

  • @sudamyasodya8119
    @sudamyasodya8119 4 ปีที่แล้ว

    Thank you very much!

    • @CuriousDrive
      @CuriousDrive  4 ปีที่แล้ว +1

      Thanks for watching Sudam. Please share with your friends.

  • @harrylyod3402
    @harrylyod3402 4 ปีที่แล้ว

    best vide thanks.

    • @CuriousDrive
      @CuriousDrive  4 ปีที่แล้ว

      Thanks for watching Harry.

  • @khalilkhalaf8182
    @khalilkhalaf8182 5 ปีที่แล้ว +2

    lazy loading it need include for virtual object

    • @CuriousDrive
      @CuriousDrive  5 ปีที่แล้ว +2

      Yes you are correct. I am gonna cover that we go deep in this series

  • @bhavyar2986
    @bhavyar2986 2 ปีที่แล้ว