SendMessageChannelCache Class

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.

System.Object
  System.ServiceModel.Activities.SendMessageChannelCache

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

'Declaration
Public NotInheritable Class SendMessageChannelCache _
	Implements IDisposable

The SendMessageChannelCache type exposes the following members.

  NameDescription
Public methodSendMessageChannelCacheInitializes a new instance of the SendMessageChannelCache class with default factory cache and channel cache settings.
Public methodSendMessageChannelCache(ChannelCacheSettings, ChannelCacheSettings)Initializes a new instance of the SendMessageChannelCache class with custom factory cache and channel cache settings.
Public methodSendMessageChannelCache(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.
Top

  NameDescription
Public propertyAllowUnsafeCachingGets or sets a value that indicates whether to turn caching on.
Public propertyChannelSettingsGets or sets the settings of the channel cache.
Public propertyFactorySettingsGets or sets the settings of the channel factory cache.
Top

  NameDescription
Public methodDisposeReleases all resources used by the current instance of the SendMessageChannelCache class.
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

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

Supported in: 4.5, 4

.NET Framework Client Profile

Supported in: 4

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft