Entity Framework 6 Tutorial: Learn Entity Framework 6 from Scratch

[ad_1]
Entity Framework 6 Tutorial: learn how to store and query data using Entity Framework 6. See both database-first and code-first workflows in action.

You can get the complete course with a big discount here:

Here you can find my other courses:

00:00 What is Entity Framework
02:07 Different Workflows
04:46 Database-first Workflow in Action
15:06 Code-first Workflow in Action
24:14 Database-first or Code-first?


Posted

in

by

Tags:

Comments

33 responses to “Entity Framework 6 Tutorial: Learn Entity Framework 6 from Scratch”

  1. Piotr Rybka Avatar

    Everything is very beautiful (as comments suggest), but again there was no mention about the most important thing. Maybe I'm wrong, but I guess databases are not usually stored on particular user's computer. Both your programs would not work on my computer, I mean they wuldn't get data from any of database on your computer, so what's the point of creating model first or code first if there is no mechanism to connect to a database wherever it is. At least you don't show it and any tutorial and book I found on EF doesn't describe it either as if it was something obvious. For God's sake I don't need a program to connect to database on my computer when I can get to it using SQL Server Management Studio. I need program to connect to dabases on the Internet, on other people's computers, GoogleDrive, wherever. This should be the starting point of any this kind tutorial: how to connect to a database.

  2. ASHISH GORANA Avatar

    what about performance between store procedures or ef

  3. Ashraf Fadol Avatar

    can I use ef against oracle database?

  4. Chris Davis Avatar

    Hello. I am trying to follow your tutorial but once I get to the context.SaveChanges(), I get this error when I run it:
    + $exception {"Unable to update the EntitySet 'Posts' because it has a DefiningQuery and no <InsertFunction> element exists in the <ModificationFunctionMapping> element to support the current operation."} System.Data.Entity.Infrastructure.DbUpdateException

  5. Edward Güereque Avatar

    What an amazing tutorial! Thank you.

  6. egl2004 Avatar

    If we get stuck while taking the course is there a specific, focused, community (ie: not StackOverflow) we can reach out to? How do we get "unstuck"?

  7. Muneeb Mashadi Avatar

    This video only shows how to add, where are update and delete?

  8. Arto Kilponen Avatar

    I have been wanting to see recent EF video tutorial for a long time. Even if this video wouldn't cover a lot of EF, as long as it states the starting point i.e. how to apply methods of old versions to EF, that is enough for me.

    I like a lot of the editing of video. No-one is actually interested in you writing the code. You can tell where and what to write, but the actual typing is pointless to see. Good work with that!

    One thing you could have in the video is pointing out typical pitfalls like "pay attention that you…". I had three of these (mostly because I didn't pay enough attention):

    1) Adding "using System.Data.Entity;" there in code first section.
    2) Typing
    "public class BlogDBDontext : DbContext"
    Gave me no errors, the database just didn't appear.

    3)
    "System.Data.Entity.Infrastructure.DbUpdateException occurred
    HResult=0x80131501
    Message=Unable to update the EntitySet 'Posts' because it has a DefiningQuery and no <InsertFunction> element exists in the <ModificationFunctionMapping> element to support the current operation.
    Source=EntityFramework
    StackTrace:
    at System.Data.Entity.Internal.InternalContext.SaveChanges()
    at System.Data.Entity.Internal.LazyInternalContext.SaveChanges()
    at System.Data.Entity.DbContext.SaveChanges()
    at EF_DatabaseFirstDemo.Program.Main(String[] args) in …EF_DatabaseFirstDemoProgram.cs:line 22

    Inner Exception 1:
    UpdateException: Unable to update the EntitySet 'Posts' because it has a DefiningQuery and no <InsertFunction> element exists in the <ModificationFunctionMapping> element to support the current operation.
    "

    which was caused by not having a primary key (your database sample has it, I had just missed it). I needed to edit and run the SQL-file to add the missed primary key. And remove and re-create the edmx. Question: As I also had my "Generate Change Script" disabled, what are the basic steps you do if you forget to add the primary key on table creation process? Is it what I wrote above, or is there a simpler way to accomplish the same?

    And a couple of questions:
    1) At 17:09 you have this jumping to App.config. I know how to get there manually, but is the method you use a part of Resharper (noticed that in your menus) and how do you launch that window?

    2) In order to get a connection string to your database, is the best way to copy-paste it from the database first example app.config or do you have some other method for that besides "just type it out from the top of your head"?

    But in overall a great video! You have clear voice and there was enough but not too much pictures for my taste.

  9. Moritz Schmidt Avatar

    Excellent tutorial! I just had to migrate my ASP.ET-Core Project to a normal ASP.NET-Prject and had problems because I was using EF-Core. With this tutorial I managed it to migrate the DataBase within 15 minutes without any probelms. Great work!

  10. Karen Nersesian Avatar

    wow you are a mentor for us 😀

  11. Valentin Demchuk Avatar

    Thanks Mosh!
    Your course is the best I've found in a week of searches on the Internet!
    A good and clear diction, an accessible explanation.
    Thanks a lot!

  12. Kristian Aggarao Avatar

    Hello Mosh, thank you for a great video. I understand it very well. Does code first can handle complex rational databases? To further explain my concern I can shoot you an email if it is okay with you.

    Thank you.
    Kristian

  13. anoop simon Avatar

    Thank you Very Much , Wonderful Tutorial…

  14. responsibleparty Avatar

    Always declare you database context in a using block, to ensure it is cleaned up in a timely manner. This should be emphasized even when you are just running a demo to illustrate workflow because it is so important.

  15. makizo 1957 Avatar

    #Mosh fantastic videos …loved it

  16. Uddip Mitra Avatar

    Mosh, where exactly on the Sql Server Management Studio 17.0 do I find the "Change Script" option?

  17. Amen Machewu Avatar

    #Programming with Mosh

    I have purchased the course, how do I download it for offline access.

  18. Ahmed Amen Avatar

    Nice Mosh, Please are that is from EF in Depth course ?

  19. Leon Du Avatar

    hi, mosh,just finished your complete mvc5 course, it was awesome. Will you publish videos about architecting and testing in mvc ,that be complete for that course.thanks

  20. Diyar Bakir Avatar

    Thanks Mosh … I watched full course of C#, probably I'm ganna watch this one. then return to continue asp.net mvc course because I'm new to .Net family and I migrate my programming life from PHP to asp.net and I'm very happy when I see Microsoft going to change asp.net to open source.. please we need tutorial about deploying asp.net project especially on Linux sever even doing on azure not bad.. I hope you have fantastic life and make more tutorials….

    for your info: Hamadan is a place in IRAN if I'm not wrong 🙂

  21. Vinay Chanumolu Avatar

    Man you are my gold !Your tutorial on MVC was sublime and this too is fantastic. Can you please post videos on ASP.NET MVC Core Middleware. My project requires a HttpHandler which is not supported on .NET Core please help !

  22. SLS UnderYah Avatar

    Thank you so much! I needed this so bad and you popped it on the screen. all your videos are awesome i will be taking this course

  23. Yasser Shaikh Avatar

    As always top notch content. Can you please make a video on Unit testing, I am sure it be helpful to all your subscribers.

  24. Ibne Nahian Avatar

    SIr,
    You are more tham amazing ! Recently I had your C# basics course on Udemy. To be honest , I learnt a lot from your course that I wasn't taught in my uni. Thanks for being awesome.

  25. Ahmed Khan Avatar

    mosh can you provide they exercise files of this tutorial? ???

  26. NazgulResebo Avatar

    My favorite option is code first with data base ;D

  27. Daniyal Awan Avatar

    Thank You Very Much Mosh !!

  28. Abhinav Kumar Avatar

    Very Good Mosh.. You RockOn!!!

  29. Tahir Alvi Avatar

    Mosh, well done. You simply rocks. Your presentation, conciseness ans grip on the topic is flawless.

    Thanks.

  30. Topaz Centuallas Avatar

    I already saw this course and it was great!

Leave a Reply

Your email address will not be published. Required fields are marked *