Udostępnij za pośrednictwem


Metoda Application.Upgrade

Uaktualnia jeden lub więcej pakietów usług integracji z określonym źródło lokalizacji do lokalizacji określonej docelowej.

Przestrzeń nazw:  Microsoft.SqlServer.Dts.Runtime
Zestaw:  Microsoft.SqlServer.ManagedDTS (w Microsoft.SqlServer.ManagedDTS.dll)

Składnia

'Deklaracja
Public Function Upgrade ( _
    packages As IEnumerable(Of UpgradePackageInfo), _
    source As StorageInfo, _
    destination As StorageInfo, _
    options As BatchUpgradeOptions, _
    events As IDTSEvents _
) As UpgradeResult
'Użycie
Dim instance As Application
Dim packages As IEnumerable(Of UpgradePackageInfo)
Dim source As StorageInfo
Dim destination As StorageInfo
Dim options As BatchUpgradeOptions
Dim events As IDTSEvents
Dim returnValue As UpgradeResult

returnValue = instance.Upgrade(packages, _
    source, destination, options, events)
public UpgradeResult Upgrade(
    IEnumerable<UpgradePackageInfo> packages,
    StorageInfo source,
    StorageInfo destination,
    BatchUpgradeOptions options,
    IDTSEvents events
)
public:
UpgradeResult^ Upgrade(
    IEnumerable<UpgradePackageInfo^>^ packages, 
    StorageInfo^ source, 
    StorageInfo^ destination, 
    BatchUpgradeOptions^ options, 
    IDTSEvents^ events
)
member Upgrade : 
        packages:IEnumerable<UpgradePackageInfo> * 
        source:StorageInfo * 
        destination:StorageInfo * 
        options:BatchUpgradeOptions * 
        events:IDTSEvents -> UpgradeResult 
public function Upgrade(
    packages : IEnumerable<UpgradePackageInfo>, 
    source : StorageInfo, 
    destination : StorageInfo, 
    options : BatchUpgradeOptions, 
    events : IDTSEvents
) : UpgradeResult

Parametry

Wartość zwracana

Typ: Microsoft.SqlServer.Dts.Runtime.UpgradeResult
UpgradeResult Obiekt, który określa wynik uaktualnienie jednego lub więcej opakowań.

Przykłady

Poniższy przykład pokazuje jak uaktualnić kolekcja pakietów.Oryginalne pakiety i uaktualniania pakiety są przechowywane w folderze w systemie plików.

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();
        }
    }
}