Created
February 1, 2011 05:16
-
-
Save dcrosby42/805453 to your computer and use it in GitHub Desktop.
Example snippet of Application_Start to execute migrations at startup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MvcApplication : System.Web.HttpApplication | |
{ | |
protected void Application_Start() | |
{ | |
var assembly = Assembly.GetAssembly(typeof(MvcApplication)); | |
var connectString = ConfigurationManager.ConnectStrings(“ApplicationServices”).ConnectionString; | |
var migrator = new Migrator(“SqlServer”, connectString, assembly); | |
migrator.MigrateToLastVersion(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment