Поделиться через


Application.UpdatePackage Property

Gets or sets a Boolean that indicates whether packages can be updated when an updated version is found.

Пространство имен: Microsoft.SqlServer.Dts.Runtime
Сборка: Microsoft.SqlServer.ManagedDTS (in microsoft.sqlserver.manageddts.dll)

Синтаксис

'Декларация
Public Property UpdatePackage As Boolean
public bool UpdatePackage { get; set; }
public:
property bool UpdatePackage {
    bool get ();
    void set (bool value);
}
/** @property */
public boolean get_UpdatePackage ()

/** @property */
public void set_UpdatePackage (boolean value)
public function get UpdatePackage () : boolean

public function set UpdatePackage (value : boolean)

Значение свойства

true if packages can be updated when an updated version is found; otherwise, false. The default value is false.

Замечания

If extensible objects, such as tasks, Foreach enumerators, log providers, and connection managers are updated, older packages can be updated at load time. For that to occur, the following two properties must be set to true in the application object before loading: UpdatePackage, and UpdateObjects.

Each extensible object must also implement its CanUpdate property.

The runtime tries to load the old package, and if it finds an older object, attempts an update. The runtime first enumerates all the extensible objects it contains, excluding the Pipeline, which is treated separately and locally. For each object, the runtime then calls CanUpdate on the new objects, passing the ID of the old object. If the new object can update the old one, the old object is passed to the new one by using its Update method, and its XML is changed in place. By default, all extensible objects implement CanUpdate to return false; therefore, the XML that is passed is not updated.

Пример

The following code example shows how to enable and disable updates. It sets the UpdatePackage to true, prints the value, resets the value of the property to false, and prints out the value again.

class ApplicationTests
    {
        static void Main(string[] args)
        {
            Application app = new Application();
           
            Boolean updatePkg = true;
            app.UpdatePackage = updatePkg;
            Console.WriteLine(app.UpdatePackage);

            updatePkg = false;
            app.UpdatePackage = updatePkg;
            Console.WriteLine(app.UpdatePackage);
        }
    }
Class ApplicationTests
        Shared  Sub Main(ByVal args() As String)
            Dim app As Application = New Application() 
 
            Dim updatePkg As Boolean = True 
            app.UpdatePackage = updatePkg
            Console.WriteLine(app.UpdatePackage)
 
            updatePkg = False
            app.UpdatePackage = updatePkg
            Console.WriteLine(app.UpdatePackage)
        End Sub
End Class

Sample Output:

True

False

Синхронизация потоков

Any public static (Shared in Microsoft Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Платформы

Платформы разработки

Список поддерживаемых платформ см. в разделе Hardware and Software Requirements for Installing SQL Server 2005.

Целевые платформы

Список поддерживаемых платформ см. в разделе Hardware and Software Requirements for Installing SQL Server 2005.

См. также

Справочник

Application Class
Application Members
Microsoft.SqlServer.Dts.Runtime Namespace