Это видео недоступно.
Сожалеем об этом.
Entity Framework Core + Blazor - Tutorial for Beginners
HTML-код
- Опубликовано: 13 авг 2024
- If you're a c# developer and you've not used it yet, you've probably heard of Entity Framework.
Entity Framework is an industry standard Object-Relational Mapping Framework for .NET that allows you interact with SQL through classes in C#, instead of directly executing queries against a database.
In this video, I take you through the basics of how EF can be used, with an example of it's implementation in Blazor.
Chapters:
00:00 What is EF Core and Why Would We Use It?
02:49 Installing EF Core
04:03 Creating a Db Context
05:42 DbContextFactory and Dependency Injection
07:56 Connection Strings / Creating the DB
12:05 DbSets and Models
15:55 Migrations
25:43 Relations
26:46 Create a Service for Interacting with the Context
30:13 Insert a New Record
33:10 End Example - Inserting a Customer to the DB via a Form
41:23 Save Changes to DB
43:32 Get Records from DB
47:00 Update Records within DB
50:19 Remove Records from DB
#dotnet #entityframework #entityframeworkcore #csharp #blazor #tutorial
I love the way you explain concepts with provided examples.
Probably one of the best videos I've seen in years, cheers! Subbed
Awesome, thank you! Really kind and glad to have you!
Love it! I had a very difficult time understanding EF, your video helped me a lot to understand the basics !
Glad it helped!
Thank you so much sir! That was a short and sweet video explaining some very important concepts. Honestly before this video I didn’t understood what was the point of using of Services . And now I understood that this is for data access and not to do it directly.
You're very welcome!
I am a software engineer degree apprentice. This video is a gem, thank you mate!
Great video! Really well explained and easy to follow.
I had a hard time understanding videos from others creators because they skip explaining the boilerplate stuff. I love the you take your time building each file instead of scaffolding everything.
Glad it was helpful!
Great video really enjoyed your style and simple explanation of using ef in a blazor project 👍
I just want to say thank you! Your video really helped me in the transition process in web app building.
You are so welcome!
You just saved me!! i am passing my blazor course thanks to you bless uu
I just got admission to a Software company and surprisingly the use of core and Blazor sever app. And to be sincere this is the best video on the internet for a fresh start I watch a couple more but this 🔥🔥🔥. Please can you do more EFC AND BLAZOR CONTENTS 🙏🏼🙏🏼🙏🏼
Glad I could help! More EFC and Blazor to come!
Clearly under-rated video, good job!
Thanks!
Excellent video, very well explained!
Glad it was helpful!
just finished the video, what a video. Keep it up
This is a fantastic tutorial, thanks so much! I learned loads today.
This is an excellent tutorial on EF Core. Good work!
Glad it was helpful!
Thanks for this, very clear instructions on EF that were very useful to me.
Glad it was helpful!
Thanks for the video , i like how you can see the SQL query in the output window. Would be nice if you showed how to CRUD or atleast create with the order model since its a foreign key
Great suggestion!
Very well done!
Thanks!
Brilliant video, very helpful thank you! I'm just stuck on creating a method so I can output the input table data to a web page
Thanks Gavin! You'd want to take the entity collection you get from EF and loop over it, adding the relevant table rows in html for each row of data. If you want to go through your issue a bit more detail, get in touch with me here www.automationmission.com/contact/
Very good video! You helped me to go forward with my masters thesis. Thank you very much :)
Ah amazing! Makes this worth it. Thanks 👍
Explained like a god! Thank you very much!!
Fantastic. This helped a lot. Thank you!
Really glad it helped!
정말 좋은 내용이네요. 감사합니다.
네가 좋다 니 기쁘다! 시청 해주셔서 감사합니다.
Thank you very much Nick! This is a very valuable video !
My pleasure!
I really hope you can answer this questions. So in the tutorial you show how to insert a customer. But the questions is how do you insert a Order when you have that association or foreign key (class). I am trying to follow your tutorial but im struggling to do an insert statement with the orders class. Im wondering if there is something I am missing here. I gave the orders property customer a customer, but in the database it simply has an id so im not sure how that works.
Do you have the [Key] attribute on your DB classes? Check your migrations also, they should show you what relationships have been created in EF
Nick, this is really fantastic. I will definitely subscribe to your channel! Thank you so much!
Thanks gideon! Really appreciate it!
Thx Nick. This is useful as a beginner. One question about the CustomerService method AddCustomer. We could also do it as async and call it AddCustomerAsync, correct ? Of course, the method signature would change to public async Action AddCustomerAsync(), correct ? As a newbie, I am trying to understand when to use async/await and when not to.
Lots of arguments for and against async programming in different situations. This article has some good examples stackify.com/when-to-use-asynchronous-programming/
Great Video! Thank you!
Glad you liked it!
Nice tutorial. One question has anyone made as good video like this where also concurrency is implemented. I mean for example situation where multiple users are updating or reading same table or even rows at the same time from own computers.
Good Video
Keep it up
What exactly you are trying to achieve here
Anything specific
Thanks
Hi Nick! There is another question, when I click create first try after running, data can insert to database, but second time I tried create(The values are different), the error "Cannot insert explicit value for identity column in table 'Customers' when IDENTITY_INSERT is set to OFF."will be triggered, Do you have any idea?
Looks like you're trying to pass in a value for the 'id' column, but it is set to be managed on the SQL side. Take a look at the model you're inserting, and see if you've set a value for the id. If so, take it out and let SQL assign it.
@@nickproudprogrammer God bless you for this easiest EF with balzor, I have ever come across, but i continue to have the same SqlException: Cannot insert explicit value for identity column in table 'Customers' when IDENTITY_INSERT is set to OFF. and i have checked my code very well and im using the same Model you used. Pls what could be wrong.
Great video, thanks
Glad you liked it!
Tysm for such a great video, u r best
My pleasure 😊
Excellent stuff! A clear example how to use DbContext factory with Blazor Server as recommended by Microsoft. When you say "using (var context = _dbContextFactory...)" the DbContext instance will get disposed automatically as it should, right?
Thanks! Yes using will allow the object to auto dispose of it implements idisposable
Thank you!
Very welcome
Top man!
I got stuck when adding the initial migration with a "The specified deps.json [C:\Users\xxx\source
epos\New folder\BlazorDemo\BlazorDemo\bin\Debug
et7.0\BlazorDemo.deps.json] does not exist" error and did not find solution.
How did you create the project? Did you create it via the command line?
Very nice
Thanks!
Things get a little spicy when dealing with objects that have complex relationships/navigations. Seems to be difficult to find educational content involving that type of thing.
Hi Nick! Thanks for your guiding! I followed your code, but click create button no response, do you have any idea? Thanks a lot! I searched and tried several ways but no success
Hi! Did you define a method to handle the onclick event? If you want to send me you code, DM me on twitter. @nickproud
@@nickproudprogrammer Yeah, I added the OnInvalidSubmit="HandleSubmit" , I will send you the code, thanks a lot!
thanks dude
You're welcome!
@@nickproudprogrammer I got accepted for the internship thanks to you.
@@456btpro8 wow amazing! Congratulations I'm glad my video helped.