詳細流程請參考(本人測試過,很好用):
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 -1; } Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("Success!"); Console.ResetColor(); return 0; }
。。。。。。。。