Package.EnableConfigurations Propriété

Définition

Obtient ou définit une valeur qui indique si le package charge les configurations.

public:
 property bool EnableConfigurations { bool get(); void set(bool value); };
[Microsoft.SqlServer.Dts.Runtime.Localization.LocalizablePropertyDescription(typeof(Microsoft.SqlServer.Dts.Runtime.Localized), "EnableConfigurationsDesc")]
public bool EnableConfigurations { get; set; }
[<Microsoft.SqlServer.Dts.Runtime.Localization.LocalizablePropertyDescription(typeof(Microsoft.SqlServer.Dts.Runtime.Localized), "EnableConfigurationsDesc")>]
member this.EnableConfigurations : bool with get, set
Public Property EnableConfigurations As Boolean

Valeur de propriété

Boolean

true si le package charge des configurations ; sinon, false.

Attributs

Exemples

L’exemple suivant crée un package, puis définit la EnableConfigurationstruevaleur , ainsi que la ExportConfigurationFile propriété. L’exemple ajoute ensuite une nouvelle configuration au package et définit la valeur de plusieurs propriétés.

Package pkg = new Package();  
pkg.EnableConfigurations = true;  
pkg.ExportConfigurationFile("conf.xml");  
// Create a variable object and add it to the   
// package Variables collection.  
Variable varPkg = pkg.Variables.Add("var", false, "", 100);  
varPkg.Value = 1;  
string packagePathToVariable = varPkg.GetPackagePath();  

Configuration config = pkg.Configurations.Add();  
config.ConfigurationString = "conf.xml";  
config.ConfigurationType = DTSConfigurationType.ConfigFile;  
config.PackagePath = packagePathToVariable;  
// more code here.  
Dim pkg As Package =  New Package()   
pkg.EnableConfigurations = True  
pkg.ExportConfigurationFile("conf.xml")  
' Create a variable object and add it to the   
' package Variables collection.  
Dim varPkg As Variable =  pkg.Variables.Add("var",False,"",100)   
varPkg.Value = 1  
Dim packagePathToVariable As String =  varPkg.GetPackagePath()   

Dim config As Configuration =  pkg.Configurations.Add()   
config.ConfigurationString = "conf.xml"  
config.ConfigurationType = DTSConfigurationType.ConfigFile  
config.PackagePath = packagePathToVariable  
' more code here.  

Remarques

Si cette propriété est définie sur false, les valeurs persistantes du package sont utilisées, plutôt que remplacées par les configurations chargées.

Lors du déploiement du package, vous pouvez définir cette false valeur avec la dernière configuration. Ensuite, lorsque le package est exécuté en premier après le déploiement, les valeurs du package sont remplacées une fois par les valeurs de configuration. Pour plus d’informations sur les configurations utilisées par un package, consultez Créer des configurations de package.

S’applique à