EnableConfigurations 属性

Indicates whether the package loads configurations.

命名空间:  Microsoft.SqlServer.Dts.Runtime
程序集:  Microsoft.SqlServer.ManagedDTS(在 Microsoft.SqlServer.ManagedDTS.dll 中)

语法

声明
Public Property EnableConfigurations As Boolean
    Get
    Set
用法
Dim instance As Package
Dim value As Boolean

value = instance.EnableConfigurations

instance.EnableConfigurations = value
public bool EnableConfigurations { get; set; }
public:
property bool EnableConfigurations {
    bool get ();
    void set (bool value);
}
member EnableConfigurations : bool with get, set
function get EnableConfigurations () : boolean
function set EnableConfigurations (value : boolean)

属性值

类型:System. . :: . .Boolean
true indicates that configuration files are loaded when the package is loaded.

注释

If this property is set to false, the persisted values in the package will be used, rather than overwritten by the loaded configurations.

When deploying the package, you can set this to false with the last configuration. Then, when the package is first run after deployment, the package values will be overwritten once by the configuration values. For more information about configurations used by a package, see 创建包配置.

示例

The following example creates a new package, and then sets the EnableConfigurations to true, as well as the ExportConfigurationFile property. The example then adds a new configuration to the package and sets the value of several properties.

            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.