public void Adding_Reference_Also_Creates_SqlCmdVar() { var parser = new HeaderParser(".\\Test.dacpac"); string fileName = string.Format("c:\\bloonblah{0}.dacpac", Guid.NewGuid().ToString().Replace("{", "").Replace("}", "").Replace("-", "")); const string logicalName = "blooblah.dacpac"; const string externalParts = "[$(blooblah)]"; const string suppressMissingDependenciesErrors = "False"; var newCustomData = new CustomData("Reference", "SqlSchema"); newCustomData.AddMetadata("FileName", fileName); newCustomData.AddMetadata("LogicalName", logicalName); newCustomData.AddMetadata("ExternalParts", externalParts); newCustomData.AddMetadata("SupressMissingDependenciesErrors", suppressMissingDependenciesErrors); newCustomData.RequiredSqlCmdVars.Add("BloopyBloo"); var writer = new HeaderWriter(".\\Test.dacpac", new DacHacFactory()); writer.AddCustomData(newCustomData); writer.Close(); var actualItem = parser.GetCustomData() .Where( p => p.Category == "SqlCmdVariables" && p.Type == "SqlCmdVariable" && p.Items.Any(item => item.Name == "BloopyBloo")); Assert.IsNotNull(actualItem); }
private void AddReferences() { var parser = new HeaderWriter(_outputPath, new DacHacFactory()); foreach (var reference in _references) { parser.AddCustomData(reference.GetData()); } parser.Close(); }
private void WriteFinalDacpac(TSqlModel model, string preScript, string postScript) { var metadata = new PackageMetadata(); metadata.Name = "dacpac"; DacPackageExtensions.BuildPackage(_targetPath, model, metadata); var writer = new HeaderWriter(_targetPath, new DacHacFactory()); foreach (var customData in _globalHeaders) { writer.AddCustomData(customData); } writer.Close(); AddScripts(preScript, postScript, _targetPath); model.Dispose(); }