예제 #1
0
        public override IExecutionResult Run()
        {
            var connection          = new SqlConnection(string.Format(@"Data Source={0};Initial Catalog=master;Integrated Security=SSPI;", Etl.Server));
            var integrationServices = new IntegrationServices(connection);

            Catalog     catalog;
            PackageInfo package;

            GetPackage(integrationServices, out catalog, out package);


            var setValueParameters = new Collection <PackageInfo.ExecutionValueParameterSet>();

            setValueParameters.Add(new PackageInfo.ExecutionValueParameterSet
            {
                ObjectType     = 50,
                ParameterName  = "SYNCHRONIZED",
                ParameterValue = 1
            });
            var parameters = Parameterize(Etl.Parameters, package.Parameters, package.Name);

            parameters.ToList().ForEach(p => setValueParameters.Add(p));

            long executionIdentifier = -1;

            if (Etl.Timeout == 0)
            {
                executionIdentifier = package.Execute(Etl.Is32Bits, null, setValueParameters);
            }
            else
            {
                executionIdentifier = package.Execute(Etl.Is32Bits, null, setValueParameters, Etl.Timeout);
            }

            var execution = catalog.Executions[executionIdentifier];

            var etlRunResultFactory = new EtlRunResultFactory();

            var result = etlRunResultFactory.Instantiate(
                execution.Status
                , execution.Messages.Where(m => m.MessageType == 120 || m.MessageType == 110).Select(m => m.Message)
                , execution.StartTime
                , execution.EndTime);

            return(result);
        }
예제 #2
0
        public override IExecutionResult Run()
        {
            var connection = new SqlConnection(string.Format(@"Data Source={0};Initial Catalog=master;Integrated Security=SSPI;", Etl.Server));
            var integrationServices = new IntegrationServices(connection);

            Catalog catalog;
            PackageInfo package;
            GetPackage(integrationServices, out catalog, out package);

            var setValueParameters = new Collection<PackageInfo.ExecutionValueParameterSet>();
            setValueParameters.Add(new PackageInfo.ExecutionValueParameterSet
            {
                ObjectType = 50,
                ParameterName = "SYNCHRONIZED",
                ParameterValue = 1
            });
            var parameters = Parameterize(Etl.Parameters, package.Parameters, package.Name);
            parameters.ToList().ForEach(p => setValueParameters.Add(p));

            long executionIdentifier = -1;
            if (Etl.Timeout==0)
                executionIdentifier = package.Execute(Etl.Is32Bits, null, setValueParameters);
            else
                executionIdentifier = package.Execute(Etl.Is32Bits, null, setValueParameters, Etl.Timeout);

            var execution = catalog.Executions[executionIdentifier];

            var etlRunResultFactory = new EtlRunResultFactory();

            var result = etlRunResultFactory.Instantiate(
                execution.Status
                , execution.Messages.Where(m => m.MessageType == 120 || m.MessageType == 110).Select(m => m.Message)
                , execution.StartTime
                , execution.EndTime);

            return result;
        }