Export (0) Print
Expand All

ActivityConfigurationAttribute Class

System Center
Marks a specific property in an Activity class as one that can be used to inject configuration data.

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

'Usage
Dim instance As ActivityConfigurationAttribute

[AttributeUsageAttribute(AttributeTargets.Property, AllowMultiple=false, Inherited=false)] 
public sealed class ActivityConfigurationAttribute : Attribute
/** @attribute AttributeUsageAttribute(AttributeTargets.Property, AllowMultiple=false, Inherited=false) */ 
public final class ActivityConfigurationAttribute extends Attribute
AttributeUsageAttribute(AttributeTargets.Property, AllowMultiple=false, Inherited=false) 
public final class ActivityConfigurationAttribute extends Attribute

[ActivityData("SMTP Mail Client")]
public class SmtpMailClientAdapter
{
    private readonly SmtpClient client = new SmtpClient();

    [ActivityInput]
    public string MailServer { set { client.Host = value; } }

    [ActivityInput]
    public int Port { set { client.Port = value; } }

    public void Send(MailAddress to, MailAddress from, string subject, string body)
    {
        client.Send(to.Address, from.Address, subject, body);
    }
}

[Activity("SMTP Send Mail")]
public class SmtpSendMail
{
    private SmtpMailClientAdapter client;
    private MailAddress to, from;
    private string subject, body;

    [ActivityConfiguration]
    public SmtpMailClientAdapter Client{ set { client = value; } }

    [ActivityInput]
    public MailAddress To { set { to = value; } }

    [ActivityInput]
    public MailAddress From { set { from = value; } }

    [ActivityInput]
    public string Subject { set { subject = value; } }

    [ActivityInput]
    public string Body { set { body = value; } }

    [ActivityMethod]
    public void Send()
    {
        client.Send(to, from, subject, body);
    }
}

The primary reason for encapsulating ActivityInputAttribute properties in a separate ActivityConfiguration class is to allow configuration information to be shared by more than one Activity class.

Another reason for providing an ActivityConfiguration property is to support classes that implement the IActivity interface in order to dynamically collect design details that are based on a specific configuration.

There are some restrictions on which properties can be marked with the ActivityConfiguration attribute:

  • The property must have a public set method.

  • The property type must be a class that is marked with the ActivityData attribute.


System.Object
   System.Attribute
    Microsoft.SystemCenter.Orchestrator.Integration.ActivityConfigurationAttribute

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

Development Platforms

Windows Vista, Windows Server 2003, and

Target Platforms

 
Show:
© 2014 Microsoft