MessageFilterTable<TFilterData>.Add 方法

定义

将筛选器及其关联的 FilterData 添加到筛选器表。Adds a filter and its associated FilterData to the filter table.

重载

Add(KeyValuePair<MessageFilter,TFilterData>)

将 filter/FilterData(键/值)对添加到筛选器表。Adds a filter/FilterData (key/value) pair to the filter table.

Add(MessageFilter, TFilterData)

将筛选器及其关联的 FilterData 添加到筛选器表。Adds a filter and its associated FilterData to the filter table.

Add(MessageFilter, TFilterData, Int32)

将筛选器及其关联的 FilterData 添加到具有指定优先级的操作筛选器表中。Adds a filter and its associated FilterData to the action filter table with a specified priority.

Add(KeyValuePair<MessageFilter,TFilterData>)

将 filter/FilterData(键/值)对添加到筛选器表。Adds a filter/FilterData (key/value) pair to the filter table.

public:
 virtual void Add(System::Collections::Generic::KeyValuePair<System::ServiceModel::Dispatcher::MessageFilter ^, TFilterData> item);
public void Add (System.Collections.Generic.KeyValuePair<System.ServiceModel.Dispatcher.MessageFilter,TFilterData> item);
abstract member Add : System.Collections.Generic.KeyValuePair<System.ServiceModel.Dispatcher.MessageFilter, 'FilterData> -> unit
override this.Add : System.Collections.Generic.KeyValuePair<System.ServiceModel.Dispatcher.MessageFilter, 'FilterData> -> unit
Public Sub Add (item As KeyValuePair(Of MessageFilter, TFilterData))

参数

item
KeyValuePair<MessageFilter,TFilterData>

已添加到表中的 KeyValuePair<TKey,TValue> <Filter, FilterData>。The KeyValuePair<TKey,TValue> <Filter, FilterData> added to the table.

实现

例外

itemnullitem is null.

适用于

Add(MessageFilter, TFilterData)

将筛选器及其关联的 FilterData 添加到筛选器表。Adds a filter and its associated FilterData to the filter table.

public:
 virtual void Add(System::ServiceModel::Dispatcher::MessageFilter ^ filter, TFilterData data);
public void Add (System.ServiceModel.Dispatcher.MessageFilter filter, TFilterData data);
abstract member Add : System.ServiceModel.Dispatcher.MessageFilter * 'FilterData -> unit
override this.Add : System.ServiceModel.Dispatcher.MessageFilter * 'FilterData -> unit
Public Sub Add (filter As MessageFilter, data As TFilterData)

参数

filter
MessageFilter

用作所添加对的键的 MessageFilterThe MessageFilter used as the key of the pair added.

data
TFilterData

与筛选器关联的、用作所添加对的值的 FilterDataThe FilterData associated with the filter used as the value of the pair added.

实现

例外

filternullfilter is null.

filter 在表中已存在。filter is already in the table.

注解

这将为筛选器分配一个默认优先级。This assigns the filter a default priority. 若要指定优先级,请使用 AddTo specify the priority, use Add.

适用于

Add(MessageFilter, TFilterData, Int32)

将筛选器及其关联的 FilterData 添加到具有指定优先级的操作筛选器表中。Adds a filter and its associated FilterData to the action filter table with a specified priority.

public:
 void Add(System::ServiceModel::Dispatcher::MessageFilter ^ filter, TFilterData data, int priority);
public void Add (System.ServiceModel.Dispatcher.MessageFilter filter, TFilterData data, int priority);
member this.Add : System.ServiceModel.Dispatcher.MessageFilter * 'FilterData * int -> unit
Public Sub Add (filter As MessageFilter, data As TFilterData, priority As Integer)

参数

filter
MessageFilter

用作所添加对的键的 MessageFilterThe MessageFilter used as the key of the pair added.

data
TFilterData

与筛选器关联的、用作所添加对的值的 FilterDataThe FilterData associated with the filter used as the value of the pair added.

priority
Int32

所添加筛选器的优先级。The priority of the filter added.

例外

filter 不能为 nullfilter cannot be null.

filter 在表中已存在。filter already exists in the table.

filter 类型与表类型不匹配。filter type does not match table type.

注解

优先级是一个整数值,用于将筛选器分组为优先级存储桶,并对它们的处理进行排序。The priority is an integer value used to group filters into priority buckets and order their processing. 分配给筛选器类型的整数越大,该筛选器类型的处理优先级就越高。The larger the integer assigned to a filter type, the higher its priority for processing. 将一起计算优先级存储桶中的所有筛选器表。All the filter tables in a priority bucket are evaluated together. 如果较高优先级存储桶未提供任何匹配项,则只会计算较低优先级存储桶。Lower priority buckets are only evaluated if higher priority buckets do not provide any matches. 使用 Add 添加一个具有默认优先级的筛选器。Use Add to add a filter with the default priority. 可以使用 DefaultPriority 来设置默认优先级。The default priority can be set using DefaultPriority. 默认优先级最初设置为 0。The default is initially set to 0.

适用于