TypeDescription

Represents a description of a Type class that contains a collection of attribute descriptions. The Type represents type declarations: class types, interface types, array types, value types, and enumeration types.

The TypeDescription class is derived from the System.Object class.

Public Methods

The TypeDescription class has the following public methods.

Method Description
Equals(Object)

Determines whether the specified Object is equal to the current Object.

GetHashCode()

Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.

GetType()

Gets the Type of the current instance.

ToString()

Returns a String that represents the current Object.

Public Properties

The TypeDescription class defines the following public properties.

Property Description
AnchorAttributes Data type: AttributeDescriptionCollection
Access type: Read-only

Gets an AttributeDescriptionCollection object. The AttributeDescriptionCollection contains a collection of AttributeDescription objects that constitute the anchor.

Attributes Data type: AttributeDescriptionCollection
Access type: Read-only

Gets an AttributeDescriptionCollection object that contains a collection of the AttributeDescription objects that exist in this Type.

Name Data type: String
Access type: Read-only

Gets a string that contains the name of the object Type.

Protected Constructors

The TypeDescription class has the following protected constructor.

Constructor Description
TypeDescription()

Creates an instance of the TypeDescription class.

Protected Methods

The TypeDescription class has the following protected methods.

Method Description
Finalize()

Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.

MemberwiseClone()

Creates a shallow copy of the current Object.

Remarks

Each TypeDescription object contains a collection of attributes and a collection of anchor attributes that are associated to the data source MA extension. Attributes and anchor attributes are represented as a AttributeDescriptionCollection of attribute objects. Each attribute object in the collection is represented as an AttributeDescription object. To get the attributes on an object—for example, through the WriteLine method—you must declare the TypeDescriptionCollection in order to have access to the AttributeDescription objects. The following code example demonstrates how to do this.

Examples

The following example declares a TypeDescriptionCollection.

Imports Microsoft.MetadirectoryServices
Imports System.IO
Imports System.Xml

Public Class NextGenMACDextensionObject
    Implements IMAExtensibleFileImport
    Dim tabchar As String = ControlChars.Tab
    Dim CRLFchar As String = ControlChars.CrLf


    Public Sub GenerateImportFile(ByVal fileName As String, ByVal connectTo As String, ByVal user As String, ByVal password As String, ByVal configParameters As Microsoft.MetadirectoryServices.ConfigParameterCollection, ByVal fFullImport As Boolean, ByVal types As Microsoft.MetadirectoryServices.TypeDescriptionCollection, ByRef customData As String) Implements Microsoft.MetadirectoryServices.IMAExtensibleFileImport.GenerateImportFile

        'declarations

        'Need to move the file settings down to after we have read the config parameters
        Dim importFile As StreamWriter = New StreamWriter(fileName)

        Dim MyFile As StreamWriter = New StreamWriter(configParameters("path").Value & "\params.txt")
        Dim ConfigParam As ConfigParameter
        Dim AttrDesc As AttributeDescription
        Dim TypeDesc As TypeDescription
        Dim inFileName As String

        'this code writes config params before it does anything else
        Try

            MyFile.WriteLine("-----------------------------------------------------------------------")
            MyFile.WriteLine("Configuration parameters for NextGen MA written " & Now())
            MyFile.WriteLine("-----------------------------------------------------------------------")
            MyFile.WriteLine("This is the start of the configuration parameters for the NextGen MA")
            MyFile.WriteLine("")
            MyFile.WriteLine("Writing static parameters now")
            MyFile.WriteLine("-----------------------------------------------------------------------")
            MyFile.WriteLine("File name = " & fileName)
            MyFile.WriteLine("Connect to = " & connectTo)
            MyFile.WriteLine("User = " & user)
            MyFile.WriteLine("Password (DON'T DO THIS) = " & password)

            'go through config parameters string array

            MyFile.WriteLine("")
            MyFile.WriteLine("Writing additional parameter array now")
            MyFile.WriteLine("-----------------------------------------------------------------------")
            For Each ConfigParam In configParameters
                MyFile.Write(ConfigParam.Name & " = ")
                If ConfigParam.IsEncrypted Then
                    'don't write the value of encrypted config parameters to the file like this
                    MyFile.WriteLine("encrypted parameter (DON'T DO THIS) = " & ConfigParam.Value)
                Else
                    'write the value to the file
                    MyFile.WriteLine(ConfigParam.Value)
                End If
            Next

            MyFile.WriteLine("-----------------------------------------------------------------------")
            MyFile.WriteLine("end of configuration parameters section")
            MyFile.WriteLine("-----------------------------------------------------------------------")
            MyFile.WriteLine("")
            MyFile.WriteLine("-----------------------------------------------------------------------")
            MyFile.WriteLine("Writing import run step type")
            MyFile.WriteLine("-----------------------------------------------------------------------")

            If fFullImport Then
                'doing a full import now
                inFileName = configParameters("path").Value & "\" & configParameters("fullfile").Value
                MyFile.WriteLine("Doing a full import reading XML file " & inFileName)
            Else
                'doing a delta import
                inFileName = configParameters("path").Value & "\" & configParameters("deltafile").Value
                MyFile.WriteLine("Doing a delta import reading XML file " & inFileName)
            End If
            MyFile.WriteLine("-----------------------------------------------------------------------")

            'now we'll write the schema to the file with each attribute indented under its type
            MyFile.WriteLine("Writing CS schema to file")
            MyFile.WriteLine("-----------------------------------------------------------------------")
            'write the schema's object type attribute name
            MyFile.WriteLine("Number of object types in schema: " & types.Count & ", object type attribute name is:" & types.ObjectTypeAttributeName)


            'Now write the object types and corresponding attributes
            For Each TypeDesc In types

                'write each object type name
                MyFile.WriteLine(TypeDesc.Name)

                'write anchor attribute definition heading
                MyFile.Write(tabchar & "Anchor attribute list:")

                For Each AttrDesc In TypeDesc.AnchorAttributes
                    'write information about the anchor attributes
                    MyFile.WriteLine(tabchar & tabchar & AttrDesc.Name)
                Next
                MyFile.WriteLine("")

                'iterate through the attributes defined for this type
                For Each AttrDesc In TypeDesc.Attributes

                    'write the attribute information
                    MyFile.WriteLine(tabchar & AttrDesc.Name & ", type is: " & AttrDesc.DataType.ToString & ", is anchor: " & AttrDesc.IsAnchor & ", is multi-valued: " & AttrDesc.IsMultiValued)
                Next
            Next

            MyFile.WriteLine("-----------------------------------------------------------------------")
            MyFile.WriteLine("Done writing schema")
            MyFile.WriteLine("-----------------------------------------------------------------------")
            MyFile.WriteLine("Closing file")
            MyFile.Close()

        Catch ex As Exception
            Throw New UnexpectedDataException("Exception while writing confuration data to params.txt" & CRLFchar & ex.Message & CRLFchar & ex.StackTrace)

        End Try
    End Sub
End Class

Requirements

Product Microsoft Identity Integration Server 2003 SP1
Namespace Microsoft.MetadirectoryServices
Assembly Microsoft.MetadirectoryServices
.NET Framework .NET Framework 2.0

See Also

Type

Send comments about this topic to Microsoft

Build date: 2/16/2009