0% found this document useful (0 votes)
19 views

Setting Up Entity Framework: Thomas Claudius Huber

This document discusses setting up Entity Framework for data access in a WPF application. It involves creating a DbContext subclass, adding a code first migration to generate the database, seeding the database with data, and adding constraints. The FriendDataService is used to asynchronously load data from the Entity Framework-backed database.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

Setting Up Entity Framework: Thomas Claudius Huber

This document discusses setting up Entity Framework for data access in a WPF application. It involves creating a DbContext subclass, adding a code first migration to generate the database, seeding the database with data, and adding constraints. The FriendDataService is used to asynchronously load data from the Entity Framework-backed database.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

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

You might also like