WebServiceTask.DebugMode Properti

Definisi

Mendapatkan atau mengatur Boolean yang menunjukkan apakah tugas dalam mode debug. Properti DebugMode dapat diakses oleh beberapa utas secara bersamaan. Untuk memastikan keamanan utas dan menghindari masalah konkurensi, kelas Yang di-interlock dari Microsoft .NET Framework digunakan.

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

Nilai Properti

true jika tugas dalam mode debug; jika tidak, salah.

Penerapan

Contoh

Contoh kode berikut membuat WebServiceTask, menunjukkan pengaturan default properti, termasuk DebugMode, menggunakan TaskHost. Kemudian mengatur dua bidang untuk memperlihatkan cara mengatur nilai bidang.

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  

Contoh Output:

Connection

DebugMode False

OutputLocation

OutputType 0

OverwriteWsdlFile False

ServiceName

SuspendRequired False

WebMethodInfo

WsdlFile

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

New value of OutputType and OverwriteWsdlFile: 0, True

Keterangan

Kelas ini Interlocked menyediakan operasi atom untuk variabel yang dibagikan oleh beberapa utas. Utas proses yang berbeda dapat menggunakan mekanisme ini jika variabel berada dalam memori bersama. Untuk informasi selengkapnya, lihat Interlocked dan Interlocked Class di Pustaka Kelas .NET Framework.

Fungsi IsBreakpointTargetEnabled ini dipanggil setiap kali tugas menemukan titik henti dalam kodenya. Karena memanggil fungsi IsBreakpointTargetEnabled untuk melihat apakah target titik henti diaktifkan mahal ketika dipanggil berulang kali, DebugMode bendera digunakan untuk menunjukkan apakah yang dapat dieksekusi akan di-debug. Ketika bendera ini diatur ke false, tugas dapat menghindari panggilan untuk memeriksa titik henti yang diaktifkan. Nilai true menunjukkan bahwa tugas harus memeriksa titik henti yang diaktifkan, dan adalah ketika IsBreakpointTargetEnabled diperiksa.

Berlaku untuk