Support us .Net Basics C# SQL ASP.NET ADO.NET MVC Slides C# Programs Subscribe Buy DVD

Entity Framework Tutorial

In this video series we will discuss all the features of entity framework with examples. We will discuss
1. Schema First Approach
2. Model First Approach
3. Code First Approach

We will also discuss using entity framework in asp.net webforms and asp.net mvc applications.



Part 1 - What is Entity Framework

Part 2 - Entity Framework Model First Approach

Part 3 - Entity Framework Code First Approach

Part 4 - Customizing table, column and foreign key column names when using entity framework code first approach

Part 5 - How to handle model changes in entity framework



Part 6 - How to seed database with test data using entity framework

Part 7 - Using stored procedures with entity framework

Part 8 - Using stored procedures with entity frameowrk code first approach

Part 9 - Overriding stored procedure defaults with entity framework code first approach

Part 10 - Entity splitting in entity framework

Part 11 - Entity splitting in entity framework with code first approach

Part 12 - Table splitting in entity framework

Part 13 - Table splitting in entity framework with code first approach

Part 14 - Conditional Mapping in entity framework

Part 15 - Conditional Mapping in entity framework with code first

Part 16 - Self referencing association in entity framework

Part 17 - Self referencing association in entity framework wth code first

Part 18 - Table Per Hierarchy (TPH) inheritance in entity framework

Part 19 - Table Per Hierarchy (TPH) inheritance in entity framework with code first

Part 20 - Table Per Type (TPT) inheritance in entity framework

Part 21 - Table Per Type (TPT) inheritance in entity framework code first

Part 22 - Many to many relationship in entity framework

Part 23 - Many to many relationship in entity framework code first

Part 24 - Entity for BridgeTable in many to many relationship

Part 25 - Entity for BridgeTable in many to many relationship code first

18 comments:

  1. Great videos. Kindly make a video on many to many relationship by EntityFramework under Schema First, Modal First and Code First approach.

    Thanks in Advance!

    Regards,
    Saqib

    ReplyDelete
  2. Thank you very much for uploading not only many to many relationship tutorials and video but also inheritance and bridge table tutorials which really help me a lot. Well, I have two more questions that are
    1. if I have database table having 1000 records which is created either by database first approach or code first approach. If there is a need to add 1 or 2 more columns in table without disturbing the other records. How can i achieve this functionality.
    2. if we want to add 1 or more database table without effecting the existing tables records. How can I achieve this functionality as well.

    Besides this I am learning and developing applications using ASP.Net MVC using Jquery and Telerik Kendo UI controls. But I am using difficuilties in using Jquery with Kendo Grid. Can I ask issues which i am facing using Jquery and Kendo UI grid.

    I am very thankful to you for your help.

    Regards,
    Saqib

    ReplyDelete
  3. Another problem i am facing in entity framework that how we can handle transactions . For Example, I have web form where I inserting or updating more than one table on single click. ( first Table A id used in table B by current_IDen() and so on.) and many client using this webforms. and click and insert data. So all data will insert correctly or we need transactions for this. If needs transaction then how it is possible in EF.

    Kindly just let me know how it is possible. Or you will update video later on.

    I am very thankful to you.

    Regards,
    Saqib

    ReplyDelete
  4. How to handle multiple databases with entity framework having same schema without making multiple edmx, can there be a dynamic connection string like ado.net

    ReplyDelete
  5. Thanks for the tutorials..Some doubts
    When to use entity framework over Ado.net
    When to use which approach(Database first, Model First and Code first).

    ReplyDelete
    Replies
    1. Database approach is generally preferred when there is already a database and you are not permitted to make any changes in DB.
      You can simply create Entity based on Schema first approach.
      It is generally preferred when DB already exists or data are very important.

      While in case of code first approach.Developers have full controls over the databse data as well as on the Entity.
      You defne your code you define the database.
      Data are generally lost due to manually changes in the code.
      Here data/Database is not critical.

      Please refer this link for detail
      http://stackoverflow.com/questions/5446316/code-first-vs-model-database-first

      Delete
  6. In Part 1 Step 10 give an error when you work with Visual Studio 2013 and SQL Server 2014. You can fixed that problem by changing ProviderManifestToken="2012" in "2008" in the EmployeeModel.edmx file in Notepad. Here the link to microsoft: https://connect.microsoft.com/VisualStudio/feedback/details/806693/the-provider-did-not-return-a-providermanifest-instance-in-vs-2013-and-entityframework-6

    ReplyDelete
  7. Hello Sir,

    Is there any way in Code First approach that our application can detect that our model has changed since our last DB was created. Like Instead of the below error

    "The model backing the 'EmployeeDBContext' context has changed since the database was created."

    I want that my application throw error like "Our model has changed, please update the model first"

    ReplyDelete
    Replies
    1. Is it possible EF dont create __migrationhistory table on my first run using code first approach

      Delete
  8. Hi Sir,

    Could you please cover up all the nitty-gritty to start up afresh with EF7. From very start to get us all master EF7.

    ReplyDelete
  9. Thanks for all the tutorials.I followed all the 25 parts of Entity Framework.
    Anyone can follow your tutorials and learn things easily because your explanation is awesome.
    - yami

    ReplyDelete
  10. I have studied C# and ASP.NET. Is it necessary to study MVC or WCF before I begin with Enity Framework..

    ReplyDelete
    Replies
    1. Not required..Just ASP.NET and C# is enough..

      Delete
  11. Good video, I'm getting a " System.NullReferenceException: Object reference not set to an instance of an object."
    on the return employeeDBContext.Departments.Include("Employees").ToList();

    I have data in both tables.

    ReplyDelete
  12. Eval("Employees") should be matches with include() names

    ReplyDelete
  13. Thanks for all the tutorials.
    I have one issue,i am trying to use entity framework in report.rdlc in mvc.I don't know how to use entity dataset in mvc report. can you give me some idea.

    ReplyDelete
  14. Thanks for your tutorials.
    I use Visual Studio Community 2015 update 3, EF 6.1.3, Microsoft.AspNet.EntityDataSource 6.0. I created a model successfully, and built the solution as instructed.
    When I tried to configure Data Source for EntityDataSource on a WebForm this error showed up and I can't work around it even after I installed all the possible updates. Do you have any tips?

    "This version of the Entity Data Source Wizard is only compatible with Entity Framework 5. If you're not using Entity Framework 5 you can configure the control by editing the markup on the page. The page editor has IntelliSense support for ASP .NET controls. If you're using Entity Framework 6 you should also be using the EF6-compatibIe version of the Entity Data Source control, available as the Microsoft.AspNet.EntityDataSource package in NuGet. "

    ReplyDelete
  15. Thank you for the tutorials.

    I would like to know how would you suggest handling CRUD operations for a ASP.NET MVC application using Entity Framework with a one to many relationship in which the parent entity (ex. MLB team) and child entity (ex. players) are on the same page. I am having a hard time finding examples of editing a list of child entities (ex. players for a specific team) and sending to the database with one submit. Any guidance would be greatly appreciated.

    ReplyDelete

If you like this website, please share with your friends on facebook and Google+ and recommend us on google using the g+1 button on the top right hand corner.