Compartir a través de


Application.Upgrade Método

Definición

Actualiza uno o más paquetes de Integration Services desde una ubicación de origen especificada a una ubicación de destino especificada.

public:
 Microsoft::SqlServer::Dts::Runtime::UpgradeResult ^ Upgrade(System::Collections::Generic::IEnumerable<Microsoft::SqlServer::Dts::Runtime::UpgradePackageInfo ^> ^ packages, Microsoft::SqlServer::Dts::Runtime::StorageInfo ^ source, Microsoft::SqlServer::Dts::Runtime::StorageInfo ^ destination, Microsoft::SqlServer::Dts::Runtime::BatchUpgradeOptions ^ options, Microsoft::SqlServer::Dts::Runtime::IDTSEvents ^ events);
public Microsoft.SqlServer.Dts.Runtime.UpgradeResult Upgrade (System.Collections.Generic.IEnumerable<Microsoft.SqlServer.Dts.Runtime.UpgradePackageInfo> packages, Microsoft.SqlServer.Dts.Runtime.StorageInfo source, Microsoft.SqlServer.Dts.Runtime.StorageInfo destination, Microsoft.SqlServer.Dts.Runtime.BatchUpgradeOptions options, Microsoft.SqlServer.Dts.Runtime.IDTSEvents events);
member this.Upgrade : seq<Microsoft.SqlServer.Dts.Runtime.UpgradePackageInfo> * Microsoft.SqlServer.Dts.Runtime.StorageInfo * Microsoft.SqlServer.Dts.Runtime.StorageInfo * Microsoft.SqlServer.Dts.Runtime.BatchUpgradeOptions * Microsoft.SqlServer.Dts.Runtime.IDTSEvents -> Microsoft.SqlServer.Dts.Runtime.UpgradeResult
Public Function Upgrade (packages As IEnumerable(Of UpgradePackageInfo), source As StorageInfo, destination As StorageInfo, options As BatchUpgradeOptions, events As IDTSEvents) As UpgradeResult

Parámetros

packages
IEnumerable<UpgradePackageInfo>

La recopilación de paquetes que se va a actualizar.

source
StorageInfo

Un objeto StorageInfo que especifica la ubicación de origen para los paquetes que se van a actualizar.

destination
StorageInfo

Un objeto StorageInfo que especifica la ubicación de destino para los paquetes que se van a actualizar.

options
BatchUpgradeOptions

Un objeto BatchUpgradeOptions que especifica las opciones que se aplicarán a los paquetes durante el proceso de actualización.

events
IDTSEvents

Objeto IDTSEvents.

Devoluciones

Un objeto UpgradeResult que especifica el resultado de actualizar uno o más paquetes.

Ejemplos

En el ejemplo siguiente se muestra cómo actualizar una colección de paquetes. Los paquetes originales y los paquetes de actualización se almacenan en una carpeta del sistema de archivos.

using System;  
using System.Collections.Generic;  
using System.Collections.ObjectModel;  
using System.Text;  
using Microsoft.SqlServer.Dts.Runtime;  

namespace ConsoleApplication1  
{  
    class Program  
    {  
        static void Main(string[] args)  
        {  

            Application app = new Application();  

            UpgradePackageInfo packinfo1 = new UpgradePackageInfo("C:\\temp\\Package.dtsx", "C:\\temp\\Package.dtsx", null);  
            UpgradePackageInfo packinfo2 = new UpgradePackageInfo("C:\\temp\\Package2.dtsx", "C:\\temp\\Package2.dtsx", null);  

            Collection<UpgradePackageInfo> packages = new Collection<UpgradePackageInfo>();  
            packages.Add(packinfo1);  
            packages.Add(packinfo2);  

            StorageInfo storeinfoSource = StorageInfo.NewFileStorage();  
            storeinfoSource.RootFolder = "C:\\temp";  

            StorageInfo storeinfoDest = StorageInfo.NewFileStorage();  
            BatchUpgradeOptions upgradeOpts = new BatchUpgradeOptions();  
            upgradeOpts.Validate = true;  
            upgradeOpts.BackupOldPackages = true;  
            upgradeOpts.ContinueOnError = true;  
            upgradeOpts.ValidationFailureAsError = true;          

            MyEventsClass eventsClass = new MyEventsClass();  

            app.Upgrade(packages, storeinfoSource, storeinfoDest, upgradeOpts, eventsClass);  

        }  
    }  

    class MyEventsClass : DefaultEvents  
    {  
        public override void OnPreExecute(Executable exec, ref bool fireAgain)  
        {  
            Console.WriteLine("The PreExecute event of the " + exec.ToString() + " has been raised.");  
            Console.Read();  
        }  
    }  
}  

Se aplica a