Modifier

Partager via


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();
public SendMessageChannelCache ();
Public Sub New ()

Applies to

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);
public SendMessageChannelCache (System.ServiceModel.Activities.ChannelCacheSettings factorySettings, System.ServiceModel.Activities.ChannelCacheSettings channelSettings);
new System.ServiceModel.Activities.SendMessageChannelCache : System.ServiceModel.Activities.ChannelCacheSettings * System.ServiceModel.Activities.ChannelCacheSettings -> System.ServiceModel.Activities.SendMessageChannelCache
Public Sub New (factorySettings As ChannelCacheSettings, channelSettings As ChannelCacheSettings)

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

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);
public SendMessageChannelCache (System.ServiceModel.Activities.ChannelCacheSettings factorySettings, System.ServiceModel.Activities.ChannelCacheSettings channelSettings, bool allowUnsafeCaching);
new System.ServiceModel.Activities.SendMessageChannelCache : System.ServiceModel.Activities.ChannelCacheSettings * System.ServiceModel.Activities.ChannelCacheSettings * bool -> System.ServiceModel.Activities.SendMessageChannelCache
Public Sub New (factorySettings As ChannelCacheSettings, channelSettings As ChannelCacheSettings, allowUnsafeCaching As Boolean)

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