Exemple #1
0
		private static void WriteParentPackageApplication(string baseDirectoryPath, Package package, string parentPackageName)
		{
			Application application;
			IDTSEvents dtsEvents;

			if ((object)package == null)
				throw new ArgumentNullException(nameof(package));

			if ((object)parentPackageName == null)
				throw new ArgumentNullException(nameof(parentPackageName));

			dtsEvents = new ConsoleEvents();
			application = new Application();

			application.SaveToXml(Path.Combine(baseDirectoryPath, parentPackageName), package, dtsEvents);
		}
Exemple #2
0
		private static void WriteParentPackage(string baseDirectoryPath, Project project,
			string parentPackageName, string[] childPackageNames)
		{
			DTSExecResult dtsExecResult;
			IDTSEvents dtsEvents;

			if ((object)project == null)
				throw new ArgumentNullException(nameof(project));

			if ((object)parentPackageName == null)
				throw new ArgumentNullException(nameof(parentPackageName));

			if ((object)childPackageNames == null)
				throw new ArgumentNullException(nameof(childPackageNames));

			Console.WriteLine("*** {0} ***", parentPackageName);

			using (Package package = new Package())
			{
				project.PackageItems.Add(package, parentPackageName);

				TaskHost executePackageTaskHost;
				ExecutePackageTask executePackageTask;
				int index;

				index = 0;
				foreach (string childPackageName in childPackageNames)
				{
					// create SQL task
					executePackageTaskHost = (TaskHost)package.Executables.Add("STOCK:ExecutePackageTask");
					executePackageTaskHost.Name = string.Format("Execute Package Task ({0})", index++);

					// get inner object
					executePackageTask = (ExecutePackageTask)executePackageTaskHost.InnerObject;
					executePackageTask.PackageName = childPackageName;
				}

				WriteParentPackageApplication(baseDirectoryPath, package, parentPackageName);

				dtsEvents = new ConsoleEvents();
				dtsExecResult = package.Validate(null, null, dtsEvents, null);
			}
		}