Export (0) Print
Expand All

DtsProperty.Get Property

Returns a Boolean that indicates whether a property value can be read. This field is read-only.

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

public bool Get { get; }

Property Value

Type: Boolean
A Boolean that indicates whether a value can be read.

This property returns true when the application can extract the value of the referenced object property. When false, the property referenced is write-only. Attempts to get the property value will fail.

The following code example creates a package and adds a Bulk Insert task. It then gets the Properties, and views the Get and Set property values along with the property name.

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

namespace Executables_API
{
    class Program
    {
        static void Main(string[] args)
        {
            Package pkg = new Package();
            Executable exec = pkg.Executables.Add("STOCK:BulkInsertTask");

            // Obtain the collection.
            Executables pgkExecs = pkg.Executables;
            foreach (Executable eachExec in pgkExecs)
            {
                TaskHost th = exec as TaskHost;
                Console.WriteLine("Executable creation name is: {0}", th.CreationName);
            }
            
            // Show use of Contains.
            
            if (pgkExecs.Contains(0))
                {
                // Retrieve executable using [item] syntax.
                Executable execItem = pgkExecs[0];
                TaskHost thItem = execItem as TaskHost;
                DtsProperties myProps = thItem.Properties;
                foreach (DtsProperty dtsProp in myProps)
                {
                    Console.WriteLine("Name {0}, Get? {1} Set? {2}", dtsProp.Name, dtsProp.Get, dtsProp.Set);
                }
                Console.WriteLine("Contains returned true");
            }
            else
            {
                Console.WriteLine("Contains returned false");
            }
        }
    }
}

Sample Output:

Executable creation name is: Microsoft.SqlServer.Dts.Tasks.BulkInsertTask.BulkInsertTask, Microsoft.SqlServer.BulkInsertTask, Version=10.0.000.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91

Name BatchSize, Get? True Set? True

Name CheckConstraints, Get? True Set? True

Name CodePage, Get? True Set? True

Name CreationName, Get? True Set? False

Name DataFileType, Get? True Set? True

Name DebugMode, Get? True Set? True

Name DelayValidation, Get? True Set? True

Name Description, Get? True Set? True

Name FormatFile, Get? True Set? True

Name WaitForMe, Get? True Set? False

Contains returned true

Community Additions

ADD
Show:
© 2014 Microsoft