Package.EnableConfigurations 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取或设置一个值,该值指示包是否加载配置。
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
属性值
如果包加载配置,则为 true;否则为 false。
- 属性
示例
The following example creates a new package, and then sets the EnableConfigurations to true
, as well as the ExportConfigurationFile property. 然后,该示例向包添加新配置,并设置多个属性的值。
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.
注解
如果此属性设置为 false
,将使用包中的持久化值,而不是被加载的配置覆盖。
部署包时,可以使用最后一个配置将其 false
设置为该包。 然后,在部署后首次运行包时,配置值将覆盖包值一次。 有关包使用的配置的详细信息,请参阅 创建包配置。