SendMessageChannelCache Constructors

Definition

Initializes a new instance of the SendMessageChannelCache class.

Overloads

SendMessageChannelCache()

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

SendMessageChannelCache(ChannelCacheSettings, ChannelCacheSettings)

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

SendMessageChannelCache(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.

SendMessageChannelCache()

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

public SendMessageChannelCache ();

Applies to

.NET Framework 4.8.1 וגירסאות אחרות
מוצר גירסאות
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

SendMessageChannelCache(ChannelCacheSettings, ChannelCacheSettings)

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

public SendMessageChannelCache (System.ServiceModel.Activities.ChannelCacheSettings factorySettings, System.ServiceModel.Activities.ChannelCacheSettings channelSettings);

Parameters

factorySettings
ChannelCacheSettings

The cache settings for cached channel factories.

channelSettings
ChannelCacheSettings

The cache settings for cached channels.

Examples

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);

Remarks

For more information about channel factories, see ChannelFactory and ChannelFactory<TChannel>.

You can choose to use only the channel factory cache and disable the channel cache by passing the channelSettings parameter to this constructor initialized to a ChannelCacheSettings instance with a MaxItemsInCache value of 0. To disable the cache completely for both the channel factory cache and the channel cache, pass the factorySettings parameter to this constructor initialized to a ChannelCacheSettings instance with a MaxItemsInCache value of 0. Note that you cannot turn the channel cache on if the channel factory cache is disabled.

Applies to

.NET Framework 4.8.1 וגירסאות אחרות
מוצר גירסאות
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

SendMessageChannelCache(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.

public SendMessageChannelCache (System.ServiceModel.Activities.ChannelCacheSettings factorySettings, System.ServiceModel.Activities.ChannelCacheSettings channelSettings, bool allowUnsafeCaching);

Parameters

factorySettings
ChannelCacheSettings

The cache settings for cached channel factories.

channelSettings
ChannelCacheSettings

The cache settings for cached channels.

allowUnsafeCaching
Boolean

true to turn caching on; otherwise, false.

Remarks

By default, the cache is only available for Send activities that don't use endpoints defined in configuration. However, if you want to turn caching on in this case call this constructor with the allowUnsafeCaching parameter set to true. Next, add the new instance of this class as an extension to a workflow service host or a workflow instance.

For more information about channel factories, see ChannelFactory and ChannelFactory<TChannel>.

Applies to

.NET Framework 4.8.1 וגירסאות אחרות
מוצר גירסאות
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1