详细流程请参考(本人测试过,很好用):
http://dbup.github.io/
配置截图:
程序如下:
static int Main(string[] args)
{
var connectionString =
args.FirstOrDefault()
?? "Server=(local)\\SqlExpress; Database=MyApp; Trusted_connection=true"; var upgrader =
DeployChanges.To
.SqlDatabase(connectionString)
.WithScriptsEmbeddedInAssembly(Assembly.GetExecutingAssembly())
.LogToConsole()
.Build(); var result = upgrader.PerformUpgrade(); if (!result.Successful)
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine(result.Error);
Console.ResetColor();
return -;
} Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("Success!");
Console.ResetColor();
return ;
}
。。。。。。。。