Поделиться через


WebServiceTask.DebugMode Свойство

Определение

Возвращает или задает логическое значение, указывающее, находится ли задача в режиме отладки. Свойство DebugMode может быть одновременно доступно для нескольких потоков. Чтобы обеспечить безопасность потоков и избежать проблем с параллелизмом, используется класс Interlocked из Microsoft платформа .NET Framework.

public:
 property bool DebugMode { bool get(); void set(bool value); };
public bool DebugMode { get; set; }
member this.DebugMode : bool with get, set
Public Property DebugMode As Boolean

Значение свойства

Значение true, если задача находится в режиме отладки; в противном случае — значение false.

Реализации

Примеры

В следующем примере кода показано WebServiceTaskсоздание параметров по умолчанию для свойств, в том числе DebugModeс помощью .TaskHost Затем он задает два поля, чтобы показать, как задать значения полей.

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

namespace Microsoft.SqlServer.SSIS.Samples  
{  
    class Program  
    {  
        static void Main(string[] args)  
        {  
            Package pkg = new Package();  
            Executable exec1 = pkg.Executables.Add("STOCK:WebServiceTask");  
            TaskHost th = exec1 as TaskHost;  

            // List the default values of the Web Service task  
            // using the Properties collection of the TaskHost.  
            Console.WriteLine("Connection        {0}", th.Properties["Connection"].GetValue(th));  
            Console.WriteLine("DebugMode         {0}", th.Properties["DebugMode"].GetValue(th));  
            Console.WriteLine("OutputLocation    {0}", th.Properties["OutputLocation"].GetValue(th));  
            Console.WriteLine("OutputType        {0}", th.Properties["OutputType"].GetValue(th));  
            Console.WriteLine("OverwriteWsdlFile {0}", th.Properties["OverwriteWsdlFile"].GetValue(th));  
            Console.WriteLine("ServiceName       {0}", th.Properties["ServiceName"].GetValue(th));  
            Console.WriteLine("SuspendRequired   {0}", th.Properties["SuspendRequired"].GetValue(th));  
            Console.WriteLine("WebMethodInfo     {0}", th.Properties["WebMethodInfo"].GetValue(th));  
            Console.WriteLine("WsdlFile          {0}", th.Properties["WsdlFile"].GetValue(th));  

            Console.WriteLine("--------------------------");  
            // Show how to set a property using the TaskHost Properties.  
            th.Properties["OutputType"].SetValue(th, DTSOutputType.File);  
            th.Properties["OverwriteWsdlFile"].SetValue(th, true);  

            Console.WriteLine("New value of OutputType and OverwriteWsdlFile: {0}, {1}", th.Properties["OutputType"].GetValue(th), th.Properties["OverwriteWsdlFile"].GetValue(th));  
        }  
    }  
}  
Imports System  
Imports System.Collections.Generic  
Imports System.Text  
Imports Microsoft.SqlServer.Dts.Runtime  
Imports Microsoft.SqlServer.Dts.Tasks.WebServiceTask  

Namespace Microsoft.SqlServer.SSIS.Samples  
    Class Program  
        Shared  Sub Main(ByVal args() As String)  
            Dim pkg As Package =  New Package()   
            Dim exec1 As Executable =  pkg.Executables.Add("STOCK:WebServiceTask")   
            Dim th As TaskHost =  exec1 as TaskHost   

            ' List the default values of the Web Service task  
            ' using the Properties collection of the TaskHost.  
            Console.WriteLine("Connection        {0}", th.Properties("Connection").GetValue(th))  
            Console.WriteLine("DebugMode         {0}", th.Properties("DebugMode").GetValue(th))  
            Console.WriteLine("OutputLocation    {0}", th.Properties("OutputLocation").GetValue(th))  
            Console.WriteLine("OutputType        {0}", th.Properties("OutputType").GetValue(th))  
            Console.WriteLine("OverwriteWsdlFile {0}", th.Properties("OverwriteWsdlFile").GetValue(th))  
            Console.WriteLine("ServiceName       {0}", th.Properties("ServiceName").GetValue(th))  
            Console.WriteLine("SuspendRequired   {0}", th.Properties("SuspendRequired").GetValue(th))  
            Console.WriteLine("WebMethodInfo     {0}", th.Properties("WebMethodInfo").GetValue(th))  
            Console.WriteLine("WsdlFile          {0}", th.Properties("WsdlFile").GetValue(th))  

            Console.WriteLine("--------------------------")  
            ' Show how to set a property using the TaskHost Properties.  
            th.Properties("OutputType").SetValue(th, DTSOutputType.File)  
            th.Properties("OverwriteWsdlFile").SetValue(th, True)  

            Console.WriteLine("New value of OutputType and OverwriteWsdlFile: {0}, {1}", th.Properties("OutputType").GetValue(th), th.Properties("OverwriteWsdlFile").GetValue(th))  
        End Sub  
    End Class  
End Namespace  

Образец вывода:

Connection

DebugMode False

OutputLocation

OutputType 0

OverwriteWsdlFile False

ServiceName

SuspendRequired False

WebMethodInfo

WsdlFile

--------------------------

New value of OutputType and OverwriteWsdlFile: 0, True

Комментарии

Класс Interlocked предоставляет атомарные операции для переменных, совместно используемых несколькими потоками. Потоки различных процессов могут использовать этот механизм, если переменная находится в общей памяти. Дополнительные сведения см. в библиотеке Interlocked классов платформа .NET Framework и Interlocked Class в ней.

Функция IsBreakpointTargetEnabled вызывается каждый раз, когда задача сталкивается с точкой останова в коде. Так как вызов функции IsBreakpointTargetEnabled для определения того, включен ли целевой объект точки останова дорого при повторном вызове, DebugMode флаг используется для указания необходимости отладки исполняемого файла. Если этот флаг установлен false, задача может избежать вызова для проверки включенной точки останова. Значение true указывает, что задача должна проверять включенные точки останова и находится при IsBreakpointTargetEnabled проверке.

Применяется к