Entity Framework Migrations for Large Teams

Get up to speed on the tools and disciplines you need to maintain a database for your Entity Framework application. This course was designed for your whole team to watch over an extended lunch hour.
Course info
Rating
(25)
Level
Intermediate
Updated
Aug 16, 2016
Duration
1h 51m
Table of contents
Description
Course info
Rating
(25)
Level
Intermediate
Updated
Aug 16, 2016
Duration
1h 51m
Description

Entity Framework (EF) is the preferred mechanism for accessing a SQL database in an enterprise application. EF migrations keep the schema of the database in sync with the application. But when teams use EF migrations collaboratively, some challenges emerge. In this course, Entity Framework Migrations for Large Teams, you'll Learn how to use EF Migrations with Git and TFS source control. First, you'll learn to use Entity Framework Migrations with Git or TFS version control. Next, you'll learn to manage simple and complex database changes. Finally, you'll learn how to discover and resolve migration issues. By the end of this course you'll learn all of the techniques required in order to work better together with your team.

About the author
About the author

Mathematician and software developer, Michael L Perry applies formal proof to creating reliable software. He has developed a method starting from the works of the greats (Meyer, Rumbaugh, Knuth), and embodied it in his open-source frameworks (Update Controls and Correspondence).

More from the author
More courses by Michael Perry
Section Introduction Transcripts
Section Introduction Transcripts

Course Overview
So you're on a team working on an Enterprise application, and you're already using Entity Framework in order to access your database. Great, and hey, in order to update your database, why don't you use Entity Framework Migrations? Good choice, but wait a minute, what if somebody else checks in ahead of me? What if I need to make a complex change to the database? What if I check in a bad migration? Oh no, what if it breaks in production? Relax. I've been there. I've got your back. I, and my team, have used Entity Framework migrations to ship real enterprise software all the way to production. We've combed the internet to find the best advice, and now we've packaged it up for you. In this course you'll use Entity Framework Migrations with git or TFS version control. You'll manage simple and complex database changes, and you'll quickly discover and resolve Migrations issues. These are the techniques that my team have discovered in order to work better together, so go ahead and get your whole team together, and let's practice building Entity Framework Migrations for large teams on Pluralsight.

Entity Framework Migrations for Large Teams
Hello there. Welcome to Entity Framework Migrations for Large Teams. This is module 1, Understanding Entity Framework Migrations, and I'm Michael L. Perry, Architect and team lead at improving, and this is the course that I wish that our team had when we started our current project. You see, Entity Framework Migrations poses some pretty interesting challenges, especially with regards to using it in large teams. Challenges like using it with source control, handling large refactorings, views, stored procedures, indexes, uniqueness constraints, seed data. These are all common issues that larger teams face when they're using Entity Framework code first migrations. My team is currently building an ASP. NET web application based on. NET 4. 52, and Entity Framework 6. Right off the bat we ran into some of these problems, and so we went looking for guidance. There's lots of good resources out there that we found helped us along this process, but there wasn't anything that put them all together into one cohesive whole, and so after collecting all of that guidance I specifically designed this course to be that cohesive whole. It's designed for your team to watch together during lunch, albeit a pretty long lunch. So gather them all together, pop open Visual Studio 2015, and follow along. This is how my team uses Entity Framework code first migrations to solve real world problems.

Following a Workflow
Hello, and welcome back to Entity Framework Migrations for Large Teams. I'm Michael L. Perry. In this module we'll be talking about following a workflow. When working with Entity Framework Migrations you're going to get into a cadence. You're going to start doing things in a certain pattern that tends to work out for you and the rest of your team. This cadence includes making your model changes, adding your migrations, updating your local database, and then merging your changes with those from the rest of your team. The particular workflow that you choose should reflect how your team has decided to work together. Are you using Git for your version control or are you using TFS? If you're using Git, do you prefer to rebase in order to keep the version history nice and clean or do you prefer to use merges in order to represent all of the different parallel work that's been happening, and before you share you're work with your team you're going to want to make sure that it's correct. We'll see how to spot check our migrations, how to maintain our own local database, and how to revert our own changes whenever we need to apply those from our teammates. This module will break the problem down into three sections. We'll start by examining the happy path. What happens on your own local machine with your own local database in order to make sure that your changes are correct? After that, the next two sections we'll talk about what happens when concurrent changes occur. Which of those two sections is most applicable to you and your team will depend upon how you use version control. We'll look at the rebase style using Git, and then we'll examine the merge style using TFS. Adapting a workflow is going to help you to create more successful migrations as an individual, and to work together better as a team, so let's go ahead and get started.

Resolving Common Problems
Hello, and welcome back to Entity Framework Migrations for Large Teams. I'm Michael L. Perry. We've set forth the discipline that'll help us to create migrations without running into too many problems, but still, every once in a while you'll run into something. Let's take a few minutes to talk about resolving common problems. Our strategy is going to begin with catching those problems early using a promotional model. This'll involve continuous integration, test, and staging. Once we find the problem we will fix the problem using scripts. We already saw an example of that when we talked about uniqueness constraints, but let's go into a little bit more detail, and show a disciplined approach, and then finally, we'll take a look at some of the errors that Entity Framework itself makes while generating migrations. When these errors come up we'll have to correct them manually. So, let's go ahead and kick things off by talking about the promotional model.