Thank you for sharing. But, Is it so dangereous that what if Authors SaveChanges() call fails after Book saved to DB?. There will be not completed data in DB like Books without Authors data. 3:30
Hi, very nice, just 2 questions. 1) 3:29 - shouldn't be `_context.SaveChanges()` called at the end of the `AddBookWithAuthors()` method? If I add thousands of authors, that could become really slow to save into DB. 2) 1:21 - if I create a website page with dynamic inputs to select and add Authors (AuthorIds) and click form post, is it preferable I'm posting `BookWithAuthorVM` with a list of IDs? Because now I'm posting (for example) `BookWithAuthorVM` where there are input fields with id=BookId, id=Book_Author[0]_AuthorId and EFCore knows it should create a new Author entity. But this is a tutorial for API so in the case of API, creating these lists is the best variant? Will you show later an example of how to add these through Input fields, SelectLists?
1. I mention that another solution would be to add all the authors into an array and add the array of authors with AddRange(). In this case we have two authors and there would never be a case where you have 1000authors, so this way should be fine. 2. Yes, the idea is that this way you get to create some authors in your database and then when you add a book you could have an option saying (Please, select the authors) and then you select the checkboxes with the author names and add them. You can also add the author object with the same request if you want, but I just created the authorIds as I plan to create an Angular application after this course and use this api for the Angular app
@@DotNetHow Awesome. Thank you for your answers. :) So if there is a third nested object (Author would have Kids object with names, ages, ...) what would be the right way to Get/Post them? In JSON file it would be just another nested level. But don't know how to do that in controller/service
On Part 25, which has been scheduled to be released in two days, you will learn how to get a Publisher with Books and Books with Authors. So, you have a one-to-many (Publisher-to-Books) and then many-to-many (Books-to-Authors)
Thank you for sharing.
But, Is it so dangereous that what if Authors SaveChanges() call fails after Book saved to DB?. There will be not completed data in DB like Books without Authors data.
3:30
Hi, very nice, just 2 questions.
1) 3:29 - shouldn't be `_context.SaveChanges()` called at the end of the `AddBookWithAuthors()` method? If I add thousands of authors, that could become really slow to save into DB.
2) 1:21 - if I create a website page with dynamic inputs to select and add Authors (AuthorIds) and click form post, is it preferable I'm posting `BookWithAuthorVM` with a list of IDs? Because now I'm posting (for example) `BookWithAuthorVM` where there are input fields with id=BookId, id=Book_Author[0]_AuthorId and EFCore knows it should create a new Author entity. But this is a tutorial for API so in the case of API, creating these lists is the best variant? Will you show later an example of how to add these through Input fields, SelectLists?
1. I mention that another solution would be to add all the authors into an array and add the array of authors with AddRange(). In this case we have two authors and there would never be a case where you have 1000authors, so this way should be fine.
2. Yes, the idea is that this way you get to create some authors in your database and then when you add a book you could have an option saying (Please, select the authors) and then you select the checkboxes with the author names and add them.
You can also add the author object with the same request if you want, but I just created the authorIds as I plan to create an Angular application after this course and use this api for the Angular app
@@DotNetHow Awesome. Thank you for your answers. :) So if there is a third nested object (Author would have Kids object with names, ages, ...) what would be the right way to Get/Post them? In JSON file it would be just another nested level. But don't know how to do that in controller/service
On Part 25, which has been scheduled to be released in two days, you will learn how to get a Publisher with Books and Books with Authors.
So, you have a one-to-many (Publisher-to-Books) and then many-to-many (Books-to-Authors)
Stay tuned!
Do the views that you are using can be replaced by DTO's ?
Yes
Thank you so much!
You are welcome
Nice, Thank you so much ❤
You are welcome
hi , can you please make video of " Updating Relational Data to DB with Entity Framework Core"
I think you have an example if you check the upcoming parts