Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Validating SSIS 2012 packages programatically via SSIS Catalog Managed Object Model

I'd like to validate and then execute SSIS package stored in SSIS Catalog (Project Deployment Model) via objects from Microsoft.SqlServer.Management.IntegrationServices namespace. When I execute Validate method from PackageInfo class it only runs validation, but no wait till its end. In one example I've found author fires validation in 'fire and forget' mode - why fire it when we don't bother with result? In another one execution is fired without previous validation.

  1. Should I verify package before every execution?
  2. If so, how to do it in synchronous mode?
  3. I'm also curious with ValidationOperation Status property. It's wrapped catalog.validations status column and can have, inter alia, values succeeded (7) and completed (9) - what is difference between them?
like image 607
Piotr Sobiegraj Avatar asked Nov 03 '22 17:11

Piotr Sobiegraj


1 Answers

Ad 2: I was able to wait for validation result in a loop:

var validationId = package.Validate(false, PackageInfo.ReferenceUsage.UseAllReferences, null);
ValidationOperation validation = package.Parent.Parent.Parent.Validations[validationId];
do
{
    Thread.Sleep(1000);
    validation.Refresh();
}
while (!validation.Completed);
like image 88
Piotr Sobiegraj Avatar answered Nov 08 '22 11:11

Piotr Sobiegraj