With over 6,500 students and 1,500+ positive reviews, this course is Udemy's most popular course for learning Entity Framework!
Entity Framework is an Object / Relational Mapper (O/RM) that helps you read and write data from and to a database. In this course, Mosh, teaches you the core concepts of Entity Framework through a series of clear, concise and hands-on lectures.
Whether you're new to Entity Framework, or been using it for a while but are looking for a comprehensive course with a clean structure to fill the missing parts, you're going to love this course.
By the end of watching this course, you'll be able to:
Unlike other books or courses that teach Entity Framework like a manual, Mosh walks you through real-world scenarios using his extensive experience in the field. Not only does he teach you the fundamentals of Entity Framework, he'll also teach you best practices along the way.
In each section, you'll find exercises to help you reinforce the materials. These exercises have been chosen from real-world scenarios to help you prepare for the challenges of the real-world. Also, some sections include cheat sheets so you can quickly review what you learn in that section.
This course is produced with Entity Framework 6. If you're using an older version of Entity Framework, you can still take this course as long as your version of Entity Framework is 4.1 or higher.
In order to take this course, you should have at least 3 months experience programming in C#. If you need to strengthen your C# fundamentals, you can take Mosh's related courses:
WHAT OTHER STUDENTS WHO HAVE TAKEN THIS COURSE SAY:
"May God bless you and your efforts to create high quality courses. This has really changed my life from working as a security guard and doing websites for free, now I am a professional." -Danish Jafri
"I'm impressed by Mosh's ability to strike the right balance of topic background, demo and tip and tricks to get around common issues when learning a technology. Great job Mosh! I'm more than happy to have invested my time and money in your work." -Ben Holtzman
"Excellent course! Mosh has a brilliant style and all of his courses are well presented and very high quality. This course was no exception and I learnt a lot from it." -Steven Barnett
"It´s a pleasure following the lessons, It´s like a good book, you always want to read another chapter. This is not siimple a course of EF, it goes further, gives a very good explanation of Linq and the most brilliant description of Repository Pattern and Unity of work. Please keep doing courses. To be honest I believe that you should leave your work and spend the rest of your life teaching ;)." -Martin Suarez
"I'd taken a lot of video classes, and this is the best I'd taken. Very well explained, detailed and a good real life examples, lots of tips and more." -Oscar Vargas
"As always... Mosh nails it with his thorough explanations (without all the "I'm better than you vibe")." -Mike Loffland
100% MONEY-BACK GAUARANTEE
This course comes with a 30-day money back guarantee. If you're not happy, ask for a refund, all your money back, no questions asked.
Do you want to take your programming skills to the next level?
Join the other 6,500 happy students who have taken this course and start coding within minutes.
In this lecture, we'll create a database using a SQL script. This database will be used throughout this section to build a model using database-first workflow.
This lecture contains downloadable script in the Supplementary Materials section.
In this lecture, you'll learn some handy features of the EDMX designer that make it easy for you to work with large, complex models. You'll learn how to:
In this lecture, you'll see the XML behind an EDMX model. I'll show you the conceptual model, storage model, and the mapping between the two, both in the XML and Model Browser.
You'll also learn how to modify the mapping between the storage model and the conceptual model.
In this lecture, I'll deconstruct the connection strings with database-first models and explain what CSDL, SSDL and MSL resources mean.
In this lecture, I'll take you through a few different scenarios when you modify your database. I'll show you how to keep your model in sync with the database when you:
In this lecture, you'll learn how to import stored procedures and functions into your entity data model.
In this lecture, we'll take a closer look at the Function Import dialog box. You'll learn how to deal with legacy databases with poorly named functions / stored procedures and prevent such pollutions to affect your model. I'll also introduce you to complex types, what they are, when they are useful, and how to create them.
In this lecture, you're going to learn how to use enums in your entity data model to improve the readability and maintainability of your code. I'll teach you how to define new enums in your model, or reference an existing enum in your project.
In this lecture, you'll learn how to build a more complex model (with a few classes and different types of associations between them) using the code-first workflow. More specifically, you'll see one-to-many and many-to-many relationships.
A common misconception about the code-first workflow is that it is only suitable for greenfield projects without an existing database. In this lecture, I'm going to show you how to use the code-first workflow against an existing database.
In this lecture, I'm going to show you a common issue that many beginners face when enabling migrations on an existing database. I'll introduce you to -IgnoreChanges and -Force switches of Add-Migration command and how they help you create the initial migration against an existing database.
In this lecture, you'll learn one migration scenario: adding a new class to your model and bringing your database in sync with your model. I'll also teach you how to populate the corresponding table using code. This is useful in scenarios where your tables have reference data that need to be automatically populated as part of running migrations.
In this lecture, I'll walk you three modification scenarios:
In this lecture, you'll learn how to bring your database in sync with your model when you delete an existing class. I'll also teach you how to preserve data in your database for historical reasons.
What if one of your past migrations was a mistake? What if you shouldn't have made that change on your model? This is a scenario that happens occasionally in the real-world and many beginners don't know how to deal with these situations. In this lecture, I'll explain how to recover from your mistakes in a safe way.
There are times that you need to restore your model and database to a previous state, perhaps for maintaining an older version of your application. In this lecture, I'll present you with two strategies for doing this.
In this lecture, I'll introduce you to two ways to override code-first conventions: Data Annotations and Fluent API. I'll show you an example of each approach, and then compare them side-by-side.
In this lecture, we'll have a closer look at various data annotations to override code-first conventions. You'll learn how to override:
In this lecture, you'll put what you learned in the last lecture in action. We'll apply a few data annotations on our model and see the effect of these annotations in the database. This lecture contains downloadable project, so you can follow along with me.
In this lecture, you'll learn how to use Fluent API to override:
Here, I'll show you how to configure various kinds of relationships with Fluent API:
You'll also learn about Principal and Dependent in Entity Framework.
In this lecture, you'll put what you've learned about Fluent API in action. This lecture includes downloadable code so you can code along with me. We'll use Fluent API to:
In this lecture, you'll learn how to use Fluent API to override the name of foreign key columns in an intermediary table in a many-to-many relationship.
As you work with larger and more complex models, organising your Fluent API configurations becomes more important. In this lecture, I'll share with you my personal convention to organize your Fluent API configurations, which will incredibly simplify the maintenance of data access layer of your application.
Here, I'll give you a brief background about LINQ. I'll explain what we had to do before LINQ and how LINQ makes our job much easier.
In this lecture, I'll show you how to use LINQ to get data out of a database. You'll get familiar with two ways to use LINQ:
In this lecture, we'll have a closer look at the LINQ syntax. You'll learn how to:
In this lecture, I'll teach you how to use LINQ extension methods to:
In this video, you'll learn the additional LINQ extension methods that are not available in LINQ syntax. You'll learn how to:
In this lecture, you'll learn about deferred execution and its benefits. I'll also show you how to break this behaviour and immediately execute your queries, which is sometimes useful if your query expressions cannot be translated into SQL. I'll also introduce you to SQL Server Profiler for inspecting queries run on a database.
In this lecture, we'll dig deep into the IQueryable interface. I'll explain what it is and how it is different from IEnumerable. I'll also you introduce you to the differences between Func<> and Expression<> and how the latter allows extending queries.
In this lecture, you'll learn what lazy loading is, how it works under the hood and when to use / avoid it.
In this lecture, I'll introduce you to N + 1 problem that sometimes comes in technical interviews. I'll show you how lazy loading, if misused, can have an adverse impact on the performance of your application by causing unnecessary round-trips to the database.
In this lecture, you'll learn what eager loading is and how to use it. I'll introduce you to the Include() method and show you two ways of using it: the poor way, and the good way.
In this lecture, you'll learn how to use explicit loading to simplify complex queries that are result of too much eager loading. You'll also learn about another benefit of explicit loading: being able to apply filters when loading related objects.
In this lecture, I'll show you what happens inside DbContext as we add, modify and remove objects.
In this lecture, you'll learn how to add objects using Entity Framework. I'll show you three ways to create association between your objects and explain which approach works better in WPF or ASP.NET MVC applications:
In this lecture, you'll learn how to update objects with Entity Framework.
In this lecture, you'll learn how to remove one or a range of objects from your database. I'll show you two examples, one with CASCADE DELETE enabled, and another without it.
In this lecture, I'll show you how to get the state of your objects from DbContext. This can be useful when troubleshooting your applications and you want to know exactly what is happening inside a DbContext. Also, if you want to implement an audit trail, you can get these of these objects and dump them into an audit trail.
In this lecture, I'll introduce you to a very useful tool when working with LINQ and Entity Framework: LINQPad. I'll give you a quick tour of LINQPad and how easily you can run your queries to get immediate feedback about the return values and SQL statements executed on the database.
In this lecture, I'll explain what repository pattern is and what it is not, its benefits, why and if you need, and address some of the misconceptions about repositories. Some developers argue that the repository pattern is already implemented in Entity Framework and there is no need to re-implement it. I'll explain why this argument is not correct with real-world examples.
In this lecture, I'll walk you step-by-step through implementing the repository and unit of work patterns with Entity Framework. I'll show you the interfaces and their implementation. You can download the solution in the Supplementary Materials of this lecture.
In this lecture, I'll give you a recipe to structure your applications. I'll show what classes go in each layer. You can download the solution in the Supplementary Materials of this lecture.
In this lecture, you'll see an example of Entity Framework in an ASP.NET MVC application. I'll show you how to display the list of courses on the home page and add a new course to the database. You'll learn two ways to work with contexts: the simple way by directly initialising a private field in the constructor, and a more advanced way, using dependency injection.
In this lecture, you'll see an example of Entity Framework in a WPF application. I'll show you how to bind a data grid to a list of courses and add a new course to the list.
Moshfegh Hamedani is a passionate and creative software engineer with a strong focus on pragmatism and simplicity. He started programming at the age of seven on a Commodore 64. Later, during his high school years, he started learning C and C++ . In 2002, along with the first release of .NET, he shifted his focus to C#. Since then he has been involved in the design and implementation of numerous software projects, including modern web applications, mobile apps, desktop applications and frameworks.
Aside from his career as a software engineer, he truly enjoys sharing his knowledge with others. Since his early twenties, he has been teaching courses and running workshops on C#, ASP. NET, object-oriented programming and clean coding. He is author of 6 best-selling courses on Udemy and more will be coming soon.
Mosh has a Master of Science in Network Systems and a Bachelor of Science in Software Engineering. He is also a Microsoft Certified Application Developer, Technology Specialist (Web Applications) and Professional.
Outside the software world, Mosh is a photographer, a pianist and a passionate Latin dancer.