SendMessageChannelCache SendMessageChannelCache SendMessageChannelCache SendMessageChannelCache Class

定義

代表擴充,這個擴充能讓您自訂快取共用層級、通道處理站快取的設定,以及使用 Send 傳訊活動傳送訊息至服務端點的工作流程之通道快取的設定。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.

public ref class SendMessageChannelCache sealed : IDisposable
public sealed class SendMessageChannelCache : IDisposable
type SendMessageChannelCache = class
    interface IDisposable
Public NotInheritable Class SendMessageChannelCache
Implements IDisposable
繼承
SendMessageChannelCacheSendMessageChannelCacheSendMessageChannelCacheSendMessageChannelCache
實作

範例

下列範例將示範如何使用 SendMessageChannelCache 類別,在單一應用程式定義域中共用兩個工作流程應用程式之間的通道快取。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);

備註

這個類別適用於將訊息傳送至服務端點的工作流程。This class is intended for workflows that send messages to service endpoints. 這些工作流程通常是用戶端工作流程,但也可以是裝載於 WorkflowServiceHost 中的工作流程服務。These workflows are typically client workflows but could also be workflow services that are hosted in a WorkflowServiceHost.

根據預設,在 WorkflowServiceHost 所裝載的工作流程中,Send 中的所有工作流程執行個體會共用 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). 針對並非由 WorkflowServiceHost 裝載的用戶端工作流程,快取只能供工作流程執行個體使用 (執行個體層級快取)。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.

建構函式

SendMessageChannelCache() SendMessageChannelCache() SendMessageChannelCache() SendMessageChannelCache()

使用預設的處理站快取和通道快取設定,初始化 SendMessageChannelCache 類別的新執行個體。Initializes a new instance of the SendMessageChannelCache class with default factory cache and channel cache settings.

SendMessageChannelCache(ChannelCacheSettings, ChannelCacheSettings) SendMessageChannelCache(ChannelCacheSettings, ChannelCacheSettings) SendMessageChannelCache(ChannelCacheSettings, ChannelCacheSettings) SendMessageChannelCache(ChannelCacheSettings, ChannelCacheSettings)

使用自訂的處理站快取和通道快取設定,初始化 SendMessageChannelCache 類別的新執行個體。Initializes a new instance of the SendMessageChannelCache class with custom factory cache and channel cache settings.

SendMessageChannelCache(ChannelCacheSettings, ChannelCacheSettings, Boolean) SendMessageChannelCache(ChannelCacheSettings, ChannelCacheSettings, Boolean) SendMessageChannelCache(ChannelCacheSettings, ChannelCacheSettings, Boolean) SendMessageChannelCache(ChannelCacheSettings, ChannelCacheSettings, Boolean)

使用自訂處理站快取設定、自訂通道快取設定,以及指出是否要開啟快取的值,初始化 SendMessageChannelCache 類別的新執行個體。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.

屬性

AllowUnsafeCaching AllowUnsafeCaching AllowUnsafeCaching AllowUnsafeCaching

取得或設定值,這個值會指出是否要開啟快取功能。Gets or sets a value that indicates whether to turn caching on.

ChannelSettings ChannelSettings ChannelSettings ChannelSettings

取得或設定通道快取的設定。Gets or sets the settings of the channel cache.

FactorySettings FactorySettings FactorySettings FactorySettings

取得或設定通道處理站快取的設定。Gets or sets the settings of the channel factory cache.

方法

Dispose() Dispose() Dispose() Dispose()

釋放 SendMessageChannelCache 類別目前的執行個體所使用的全部資源。Releases all resources used by the current instance of the SendMessageChannelCache class.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(Inherited from Object)

適用於