
Setting the DTS Application Properties in the DTS Object Model
To enable or disable the following DTS application properties programmatically, set the following values of the DTS Application object to True (enabled) or False (disabled).
- Turn on cache
-
.TaskInfos.UseCache
.TransformationInfos.UseCache
.ScriptingLanguageInfos.UseCache
.OLEDBProviderInfos.UseCache
- Turn on just-in-time debugging
-
.JITDebug
To enable or disable the following DTS application option programmatically, set the following values of the DTS Application object to the appropriate value from the DTSDesignerSettings enumeration:
-
Enabled - DTSDesignerSettings.DTSDesigner_ShowMultiPhaseTransforms
-
Disabled - DTSDesignerSettings.DTSDesigner_Default
- Show multi-phase pump in DTS designer
-
.DesignerSettings
The value of the Enable Save to Meta Data Services property cannot be set by using the DTS object model. This property can be set by using the Registry class in the Microsoft.Win32 namespace of the .NET Framework Class Library, as demonstrated in the following sample.
Sample Code
The following code sample for a console application, when compiled and run, enables all the DTS application properties discussed in this topic. To disable the options instead, change the new values from True to False, and change the value of the DesignerSettings property to DTSDesignerSettings.DTSDesigner_Default.
This application requires a reference to the Microsoft DTSPackage Object Library (COM).
The value of the Enable Save to Meta Data Services option can only be set by modifying the Registry directly. There is no equivalent to the Enable Save to Meta Data Services option in the DTS object model.
Imports Microsoft.Win32
Imports DTS
Module SetDTSProperties
Sub Main()
Const SETTINGS_ROOT_KEY As String = "Software\Microsoft\Microsoft SQL Server\80\DTS\Settings"
Const METADATASERVICES_VALUE As String = "EnableSaveToRepository"
Dim dtsApp As New DTS.Application
Dim keySettingsRoot As RegistryKey
With dtsApp
.TaskInfos.UseCache = True
.TransformationInfos.UseCache = True
.ScriptingLanguageInfos.UseCache = True
.OLEDBProviderInfos.UseCache = True
.DesignerSettings = DTSDesignerSettings.DTSDesigner_ShowMultiPhaseTransforms
.JITDebug = True
End With
keySettingsRoot = Registry.LocalMachine.OpenSubKey(SETTINGS_ROOT_KEY, True)
If keySettingsRoot Is Nothing Then
keySettingsRoot = Registry.LocalMachine.CreateSubKey(SETTINGS_ROOT_KEY)
End If
With keySettingsRoot
.SetValue(METADATASERVICES_VALUE, Math.Abs(CType(True, Integer)))
.Close()
End With
End Sub
End Module
using Microsoft.Win32;
using DTS;
class SetDTSProperties
{
public static void Main()
{
const string SETTINGS_ROOT_KEY = "Software\\Microsoft\\Microsoft SQL Server\\80\\DTS\\Settings";
const string METADATASERVICES_VALUE = "EnableSaveToRepository";
DTS.Application dtsApp = new DTS.Application();
RegistryKey keySettingsRoot;
{
dtsApp.TaskInfos.UseCache = true;
dtsApp.TransformationInfos.UseCache = true;
dtsApp.ScriptingLanguageInfos.UseCache = true;
dtsApp.OLEDBProviderInfos.UseCache = true;
dtsApp.DesignerSettings = DTSDesignerSettings.DTSDesigner_ShowMultiPhaseTransforms;
dtsApp.JITDebug = true;
}
keySettingsRoot = Registry.LocalMachine.OpenSubKey(SETTINGS_ROOT_KEY, true);
if (keySettingsRoot==null)
{
keySettingsRoot = Registry.LocalMachine.CreateSubKey(SETTINGS_ROOT_KEY);
}
{
keySettingsRoot.SetValue(METADATASERVICES_VALUE, Math.Abs((int) true));
keySettingsRoot.Close();
}
}
}
The following subroutine can be added to an application to refresh the cache when appropriate. Cached values are stored in the Registry under HKEY_CURRENT_USER\Software\Microsoft\Microsoft SQL Server\80\DTS\Enumeration.
Private Sub RefreshCache()
Me.Cursor = Cursors.WaitCursor
With dtsApp
.TaskInfos.Refresh()
.TransformationInfos.Refresh()
.ScriptingLanguageInfos.Refresh()
.OLEDBProviderInfos.Refresh()
End With
Me.Cursor = Cursors.Default
End Sub
private void RefreshCache()
{
this.Cursor = Cursors.WaitCursor;
{
dtsApp.TaskInfos.Refresh();
dtsApp.TransformationInfos.Refresh();
dtsApp.ScriptingLanguageInfos.Refresh();
dtsApp.OLEDBProviderInfos.Refresh();
}
this.Cursor = Cursors.Default;
}
-
Stay Up to Date with Integration Services
-
For the latest downloads, articles, samples, and videos from Microsoft, as well as selected solutions from the community, visit the Integration Services page on MSDN or TechNet:
For automatic notification of these updates, subscribe to the RSS feeds available on the page.
|