Setting up Entity Framework
Thomas Claudius Huber
MICROSOFT MVP (WINDOWS DEVELOPMENT)
@thomasclaudiush www.thomasclaudiushuber.com
Module
Outline
Plan the data access layer
Create and seed the database with
Entity Framework Code First
Load data in the FriendDataService
Plan the Data Access Layer
WPF Client Database
Friend FriendOrganizer.UI
Organizer.
View
Model
ViewModel
DataService
Friend
FriendOrganizer.DataAccess
Entity Framework SQL Server
Demo Create a DbContext subclass
Add a code first migration
Add constraints
Create and seed the database
Add Constraints
Fluent API Data Annotations
Build the FriendDataService
WPF Client Database
Friend FriendOrganizer.UI
Organizer.
View
Model
ViewModel
DataService
Friend
FriendOrganizer.DataAccess
Entity Framework SQL Server
Setting up Entity Framework
Summary - Create the DbContext
- Add a code first migration
- Create and seed the database
Add constraints with Data Annotations
Load data asynchronously
in the FriendDataService