EFMigrations-ShahedChowdhuri-MSNovaCodeCamp-2013-04
Download
Report
Transcript EFMigrations-ShahedChowdhuri-MSNovaCodeCamp-2013-04
Data Access Layer
Using Code-First Migrations
Shahed
Chowdhuri
Thanks to our Sponsors
for keeping the fires lit
Introduction
Enterprise
Web
Application
Looking for Ways to Improve & Modernize
Motivation behind this design?
Our desire to do the following:
ASP.NET
MVC
TDD (Test Driven Development)
BDD (Behavior Driven Development)
CI (Continuous Integration)
DB
CD (Continuous Delivery)
Tech Check
Are you familiar with…?
EF
Code-First
Migrations
Entity
Framework
ASP
.NET
MVC
EF
Code-First
Development
Options and Alternatives
DatabaseFirst
Model-First
(EDMX)
(Visual
Designer)
Code-First
(automatic
migrations)
Code-First
(manual
migrations)
What are we trying to solve?
DAL: Agenda
1. Models &
Mapping
4. Update
Database
2. Connection
Strings
5. Push Code
+ Migrate
Server DB
3. Enable
Migrations
6. Process
Workflow
1. Models & Mapping
DBContext
.OnModelCreating()
2. Connection Strings
3. Enable Migrations
4. Update Database
model
code
migration
code
+ seed
migration
code
(sql)
dev
DB
5. Push Code + Migrate Server DB
code
push code
code
pull code
CI
Server
migrate.exe
DB
6. Process Workflow
communication
dev team
DB
DB architects
Code Walkthrough
DAL: Conclusion
Dev Team
Synchronized
Continuous
Development
Code-First
Migrations
Database
Versioning
Server
Deployment
Resources
• EF Code First Migrations on MSDN:
–
http://msdn.microsoft.com/en-US/data/jj591621
• Web.config & configSource:
– http://wakeupandcode.com/all-your-database-are-belong-to-us/
• PluralSight EF Migrations video tutorial:
– http://pluralsight.com/training/Courses/TableOfContents/efmigrations