Learn C#: Make a Databased App with Entity Framework

Learn how to create an application in C# that can generate it's own database using Entity Framework and Code First.
4.4 (63 ratings)
Instead of using a simple lifetime average, Udemy calculates a
course's star rating by considering a number of different factors
such as the number of ratings, the age of ratings, and the
likelihood of fraudulent ratings.
664 students enrolled
Take This Course
  • Lectures 24
  • Length 2.5 hours
  • Skill Level Intermediate Level
  • Languages English
  • Includes Lifetime access
    30 day money back guarantee!
    Available on iOS and Android
    Certificate of Completion
Wishlisted Wishlist

How taking a course works


Find online courses made by experts from around the world.


Take your courses with you and learn anywhere, anytime.


Learn and practice real-world skills and achieve your goals.

About This Course

Published 2/2014 English

Course Description

In this course you will learn how to create a simple C# application using Microsoft Visual Studio that creates and connects to an SQL Database with the Entity Framework*, with no database development required!

We will use Code First development principals to define all database tables and columns using only C# code.

All database tables and columns will be generated automatically from the C# code without the need to edit the database directly. As such we will be doing no database development (except for a section on calling SQL statements directly if you need to).

All source code is included as a Microsoft Visual Studio 2013 project so you can get up and running straight away.

Thank you for choosing this course and we look forward to viewing your positive reviews and feedback.

MPire Solutions Pty Ltd

* Note: The Entity Framework is Microsofts' newest data access technology, and Code First allows us to create database driven applications using only C# code, with no database development required!

What are the requirements?

  • A basic knowledge of C# and Visual Studio.
  • Microsoft Visual Studio 2012, 2013 or later is required. We show how to install Visual Studio Express if you don't already have it.

What am I going to get from this course?

  • By the end of the course you will be able to define and build an SQL database using only C# code. No database development required!
  • Perform CRUD operations (Create, Read, Update, Delete) on entities using C# code.
  • Handle entity changes using Code First Migrations.
  • For the majority of the course, we will do absolutely no database development! However, we will show how to call custom SQL statements if you need to.

Who is the target audience?

  • This course is recommended for C# developers who want to learn how to use the latest Microsoft .Net database technologies.
  • Students should have at least a basic knowledge of C# and Visual Studio.
  • While much of the code is simple C#, this course is specifically about Entity Framework Code First and is NOT an introduction to C# or building an application with C#.

What you get with this course?

Not for you? No problem.
30 day money back guarantee.

Forever yours.
Lifetime access.

Learn on the go.
Desktop, iOS and Android.

Get rewarded.
Certificate of completion.


Section 1: Introduction

Course introduction and contents.


Define a specification for the simple example sales application.

18 pages

Download the "Entity Framework Cheat Sheet" and Source Code to the sample application.

Section 2: Setup

You'll need to have Microsoft Visual Studio to do this course. If you don't already have it installed, this quick video will show you how to get the free Express Edition.


Create the example C# Windows Forms application in Microsoft Visual Studio and reference Entity Framework using NuGet.

Section 3: The Models

Create the bare-bones models (entities) as C# classes.


Create a base model which all other models can inherit from. Code reuse reduces the amount of code we need to write!


Create an interface that flags a model as being active or inactive.

Data Annotations
Section 4: Relationships

Connect models together in one-to-one relationships.


Connect models together in one-to-many relationships.

Section 5: Data Context

Create a very simple Data Context to connect to the database.


Add more advanced functionality to the Data Context, such as soft deletion and simple auditing.


After creating the Models and Data Context, we can now generate an SQL Database automatically from the code.


Learn how to change your Models and update your database accordingly with Migrations.


Insert core data into the database automatically using Seeding.

Section 6: C.R.U.D.

Learn how to Read lists of items and single items from the database.


Learn how to Create a new Sale and save it to the database.


Learn how to Update an existing Sale and save it to the database.


Learn how to Delete a Sale from the database.

Section 7: Extra Topics

How to use Enumerations in your Models.


Customize the Table and Column names that Entity Framework will use to generate the database.


Upgrading to Entity Framework 6.1 and a brief introduction to the Index attribute to quickly create database indexes on tables.

Section 8: Conclusion

Thanks for watching! Please leave a comment and rating.

Students Who Viewed This Course Also Viewed

  • Loading
  • Loading
  • Loading

Instructor Biography

Matt Turner, Software Developer and Trainer at MPire Training

I am a trainer for MPire Training, where we create high quality online training focusing on web technologies.

I have been a commercial software developer for over 15 years, building Web and Windows applications for businesses. I run a software development company that produces fast web applications for businesses.

Instructor Biography

MPire Training, We help businesses get online fast and prosper!

We offer a variety of services which range from training in all kinds of industries and marketing strategies to assist businesses to prosper online.

We have over 20 years experience in the IT industry which consist of website design, Microsoft .Net programming, Database development, Online Marketing and Training.

Ready to start learning?
Take This Course