SendMessageChannelCache Class

.NET Framework (current version)
 

Represents an extension that enables the customization of the cache sharing levels, the settings of the channel factory cache, and the settings of the channel cache for workflows that send messages to service endpoints using Send messaging activities.

Namespace:   System.ServiceModel.Activities
Assembly:  System.ServiceModel.Activities (in System.ServiceModel.Activities.dll)

System.Object
  System.ServiceModel.Activities.SendMessageChannelCache

public sealed class SendMessageChannelCache : IDisposable

NameDescription
System_CAPS_pubmethodSendMessageChannelCache()

Initializes a new instance of the SendMessageChannelCache class with default factory cache and channel cache settings.

System_CAPS_pubmethodSendMessageChannelCache(ChannelCacheSettings, ChannelCacheSettings)

Initializes a new instance of the SendMessageChannelCache class with custom factory cache and channel cache settings.

System_CAPS_pubmethodSendMessageChannelCache(ChannelCacheSettings, ChannelCacheSettings, Boolean)

Initializes a new instance of the SendMessageChannelCache class with custom factory cache settings, custom channel cache settings, and a value that indicates whether to turn caching on.

NameDescription
System_CAPS_pubpropertyAllowUnsafeCaching

Gets or sets a value that indicates whether to turn caching on.

System_CAPS_pubpropertyChannelSettings

Gets or sets the settings of the channel cache.

System_CAPS_pubpropertyFactorySettings

Gets or sets the settings of the channel factory cache.

NameDescription
System_CAPS_pubmethodDispose()

Releases all resources used by the current instance of the SendMessageChannelCache class.

System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

This class is intended for workflows that send messages to service endpoints. These workflows are typically client workflows but could also be workflow services that are hosted in a WorkflowServiceHost.

By default, in a workflow hosted by a WorkflowServiceHost, the cache used by Send messaging activities is shared across all workflow instances in the WorkflowServiceHost (host-level caching). For a client workflow that is not hosted by a WorkflowServiceHost, the cache is available only to the workflow instance (instance-level caching). Caching is disabled by default for any send activity in your workflow that has endpoints defined in configuration.

For more information about how to change the default cache sharing levels and cache settings for the channel factory and channel cache, see Changing the Cache Sharing Levels for Send Activities.

The following example shows how to use the SendMessageChannelCache class to share a channel cache between two workflow applications in a single app domain.


//sharing a channel cache between two workflow applications in a single app-domain.
sharedChannelCache = new SendMessageChannelCache(new ChannelCacheSettings { MaxItemsInCache = 5 }, new ChannelCacheSettings { MaxItemsInCache = 5 });

WorkflowApplication workflowApp1 = new WorkflowApplication(workflow);
workflowApp1.Completed = new Action<WorkflowApplicationCompletedEventArgs>(OnCompleted);
workflowApp1.Extensions.Add(sharedChannelCache);

WorkflowApplication workflowApp2 = new WorkflowApplication(workflow);
workflowApp2.Completed = new Action<WorkflowApplicationCompletedEventArgs>(OnCompleted);
workflowApp2.Extensions.Add(sharedChannelCache);

//disabling the channel cache so that channels are closed after being used.
SendMessageChannelCache disabledChannelCache = new SendMessageChannelCache(new ChannelCacheSettings { MaxItemsInCache = 0 }, new ChannelCacheSettings { MaxItemsInCache = 0 });

WorkflowApplication workflowApp3 = new WorkflowApplication(workflow);
workflowApp3.Completed = new Action<WorkflowApplicationCompletedEventArgs>(OnCompleted);
workflowApp3.Extensions.Add(disabledChannelCache);

.NET Framework
Available since 4.0

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

Return to top
Show: