Export (0) Print
Expand All
Expand Minimize

DTSConfigurationType Enumeration

Specifies the ways that a configuration for a package can be saved.

Namespace:  Microsoft.SqlServer.Dts.Runtime
Assembly:  Microsoft.SqlServer.ManagedDTS (in Microsoft.SqlServer.ManagedDTS.dll)

public enum DTSConfigurationType

Member nameDescription
ConfigFileSpecifies that the configuration is stored in a configuration file. In the SSIS Package Configuration Wizard, the Configuration File Name column is where you specify the location and name of the configuration file that the wizard generates.
EnvVariableSpecifies that the configuration is stored in an environment variable.
IConfigFileSpecifies that the configuration is stored in an environment variable that contains the information about configuration flat file.
IIniFileThis member is reserved for future use.
IniFileThis member is reserved for future use.
IParentVariableSpecifies that the configuration information is stored in an environment variable that contains the information about the package variable.
IRegEntrySpecifies that the configuration information is stored in an environment variable that contains the information about the registry entry.
ISqlServerSpecifies that the location of the configuration information is stored in an environment variable that contains information about the SQL Server .
ParentVariableSpecifies that the configuration information is stored in a package variable.
RegEntrySpecifies that the configuration information is stored in a registry entry.
SqlServerSpecifies that the configuration is stored in the SQL Server msdb database. This field is constant.

Integration Services supports many different ways of specifying configurations for a package. For more information, see Create Package Configurations.

The following code example creates a package, enables configurations, and enables the export of the configuration file. It adds a new Configuration to the package Configurations collection, and sets several properties on the configuration, including the ConfigurationType, which uses this enumeration. After saving and reloading the package, the configuration properties are displayed.

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SqlServer.Dts.Runtime;
using Microsoft.SqlServer.Dts.Tasks.BulkInsertTask;

namespace configuration_API
{
    class Program
    {    
        static void Main(string[] args)
        {
        // Create a package and set two properties.
            Package pkg = new Package();
            pkg.EnableConfigurations = true;
            pkg.ExportConfigurationFile(@"C:\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();

            // Create a configuration object and add it to the 
           // package configuration collection.
            Configuration config = pkg.Configurations.Add();

           // Set properties on the configuration object.
            config.ConfigurationString = "conf.xml";
            config.Description = "My configuration description";
            config.ConfigurationType = DTSConfigurationType.ConfigFile;
            config.PackagePath = packagePathToVariable;

            // Save the package and its configuration.
            Application app = new Application();
            app.SaveToXml(@"c:\pkg.xml", pkg, null);
            
            // Reload the package.
            Package p1 = app.LoadPackage(@"c:\pkg.xml", null);

            // Review the configuration information.
            Configurations configs_After = pkg.Configurations;
            foreach(Configuration confAfter in configs_After)
            {
                Console.WriteLine("ConfigurationString is {0}", confAfter.ConfigurationString);
                Console.WriteLine("ConfigurationType is {0}", confAfter.ConfigurationType);
                Console.WriteLine("CreationName is {0}", confAfter.CreationName);
                Console.WriteLine("Description is {0}", confAfter.Description);
                Console.WriteLine("Assigned ID is {0}", confAfter.ID);
                Console.WriteLine("Name is {0}", confAfter.Name);
            }
        }
    }
}

Sample Output:

The value of variable var = 1

ConfigurationString is conf.xml

ConfigurationType is ConfigFile

CreationName is

Description is My configuration description

Assigned ID is {9CF65E37-0833-44CD-A99D-EBFE38FAB31B}

Name is {9CF65E37-0833-44CD-A99D-EBFE38FAB31B}

Package Path is \Package.Variables[::var]

Community Additions

ADD
Show:
© 2014 Microsoft