IApplicationSettingsProvider.Upgrade 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
向提供者顯示該應用程式已升級。 這讓服務提供者有機會根據需要升級其儲存的設定。
public:
void Upgrade(System::Configuration::SettingsContext ^ context, System::Configuration::SettingsPropertyCollection ^ properties);
public void Upgrade(System.Configuration.SettingsContext context, System.Configuration.SettingsPropertyCollection properties);
abstract member Upgrade : System.Configuration.SettingsContext * System.Configuration.SettingsPropertyCollection -> unit
Public Sub Upgrade (context As SettingsContext, properties As SettingsPropertyCollection)
參數
- context
- SettingsContext
SettingsContext A 描述目前應用程式的使用情況。
- properties
- SettingsPropertyCollection
SettingsPropertyCollection A 包含 Settings 屬性群組,其值將被檢索。
備註
.NET 框架允許並排安裝與執行同一應用程式的不同版本。 應用程式設定提供者會分別儲存每個版本的應用程式設定,以確保隔離。 不過,你可能想將應用程式的舊版本設定遷移到目前版本。 為了提供此遷移功能,請使用由 Upgrade衍生的類別實作的方法SettingsProvider。
你可以將此 Upgrade 方法與遷移應用程式設定的方法結合使用,無論是 GetPreviousVersion 在安裝新版本應用程式期間或之後。
此方法應對所有應用設定 NoSettingsVersionUpgradeAttribute 中抑制,或整個由 衍生 ApplicationSettingsBase的設定包裝類別。