Share via


IActivityDesigner.AddCorellatedData Method

Add a type marked with the ActivityData attribute.

Namespace: Microsoft.SystemCenter.Orchestrator.Integration
Assembly: Microsoft.SystemCenter.Orchestrator.Integration (in Microsoft.SystemCenter.Orchestrator.Integration.dll)

Usage

'Usage
Dim instance As IActivityDesigner
Dim type As Type

instance.AddCorellatedData(type)

Syntax

'Declaration
Sub AddCorellatedData ( _
    type As Type _
)
void AddCorellatedData (
    Type type
)
void AddCorellatedData (
    Type^ type
)
void AddCorellatedData (
    Type type
)
function AddCorellatedData (
    type : Type
)

Parameters

  • type
    The type of ActivityData object to add to the design.

Example

[ActivityData]
public class FileInfoAdapter
{
    private readonly FileInfo fileInfo;

    public FileInfoAdapter(FileInfo fileInfo)
    {
        this.fileInfo = fileInfo;
    }

    [ActivityOutput, ActivityFilter]
    public string Name
    {
        get { return fileInfo.Name; }
    }

    [ActivityOutput, ActivityFilter]  
    public long Length
    {
        get { return fileInfo.Length; }
    }

    [ActivityOutput, ActivityFilter]
    public DateTime CreationTime
    {
        get { return fileInfo.CreationTime; }
    }

    [ActivityOutput, ActivityFilter]
    public DateTime LastWriteTime
    {
        get { return fileInfo.LastWriteTime; }
    }

    [ActivityOutput, ActivityFilter]
    public bool ReadOnly
    {
        get { return (fileInfo.Attributes & FileAttributes.ReadOnly) != 0; }
    }
}

[Activity]
public class GetDirectory : IActivity
{
    public void Design(IActivityDesigner designer)
    {
        designer.AddInput("Directory").WithFolderBrowser();
        designer.AddCorellatedData(typeof(FileInfoAdapter));
    }

    public void Execute(IActivityRequest request, IActivityResponse response)
    {
        DirectoryInfo dir = request.Inputs["Directory"].As<DirectoryInfo>();
        ICollection files = request.Filters.Filter(FindFiles(dir));
        response.Publish("Number of Files", files.Count);
        response.PublishRange(files);            
    }

    private IEnumerable FindFiles()
    {
        foreach (FileInfo info in path.GetFiles("*.*"))
        {
            yield return new FileInfoAdapter(info);
        }
    }        
}

Remarks

When you add a type marked with the ActivityData attribute the designer will automatically add all of the ActivityInput, ActivityFilter and ActivityOutput properties encapsulated in the type.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Platforms

Development Platforms

Windows Vista, Windows Server 2003, and

Target Platforms

Change History

See Also

Reference

IActivityDesigner Interface
IActivityDesigner Members
Microsoft.SystemCenter.Orchestrator.Integration Namespace