我正在尝试按顺序运行一些脚本来创建和播种我的数据库。但是,似乎第二个脚本永远不会运行。此外,我认为它运行第一个脚本两次。
public DatabaseFixture()
{
var connectionString = "Server=localhost;User Id = sa;Password=yourStrong(!)Password;Initial Catalog = master";
var createSchemaSqlScriptOptions = new SqlScriptOptions { ScriptType = ScriptType.RunAlways, RunGroupOrder = 1 };
var seedDataSqlScriptOptions = new SqlScriptOptions { ScriptType = ScriptType.RunAlways, RunGroupOrder = 2 };
var upgradeEngineBuilder = DeployChanges.To.SqlDatabase(connectionString, null)
.WithScriptsEmbeddedInAssembly(Assembly.GetExecutingAssembly(), script => script.Contains("0001"), createSchemaSqlScriptOptions)
.WithScriptsEmbeddedInAssembly(Assembly.GetExecutingAssembly(), script => script.Contains("0002"), createSchemaSqlScriptOptions)
.LogToConsole();
var upgrader = upgradeEngineBuilder.Build();
var result = upgrader.PerformUpgrade();
}