AddInToken.QualificationData AddInToken.QualificationData AddInToken.QualificationData AddInToken.QualificationData Property

定义

获取与当前标记关联的各个管线段的相关数据的字典。Gets a dictionary of data about the segments in the pipeline associated with the current token.

public:
 property System::Collections::Generic::IDictionary<System::AddIn::Hosting::AddInSegmentType, System::Collections::Generic::IDictionary<System::String ^, System::String ^> ^> ^ QualificationData { System::Collections::Generic::IDictionary<System::AddIn::Hosting::AddInSegmentType, System::Collections::Generic::IDictionary<System::String ^, System::String ^> ^> ^ get(); };
public System.Collections.Generic.IDictionary<System.AddIn.Hosting.AddInSegmentType,System.Collections.Generic.IDictionary<string,string>> QualificationData { get; }
member this.QualificationData : System.Collections.Generic.IDictionary<System.AddIn.Hosting.AddInSegmentType, System.Collections.Generic.IDictionary<string, string>>
Public ReadOnly Property QualificationData As IDictionary(Of AddInSegmentType, IDictionary(Of String, String))

属性值

一个字典,其键为管线段,其值为一系列名称/值对的字典,这些名称/值对表示每个段的限定数据。A dictionary whose keys are pipeline segments and whose values are dictionaries of name/value pairs that represent qualification data for each segment.

示例

下面的示例演示如何检查外接程序的限定数据。The following example shows how to examine an add-in's qualification data.

// Use qualification data to control 
// how an add-in should be activated.

if (selectedToken.QualificationData[AddInSegmentType.AddIn]["Isolation"].Equals("NewProcess"))
{
    // Create an external process.
    AddInProcess external = new AddInProcess();

    // Activate an add-in in the new process
    // with the full trust security level.
    Calculator CalcAddIn5 =
        selectedToken.Activate<Calculator>(external,
        AddInSecurityLevel.FullTrust);
    Console.WriteLine("Add-in activated per qualification data.");
}
else
    Console.WriteLine("This add-in is not designated to be activated in a new process.");
' Use qualification data to control
' how an add-in should be activated.

If selectedToken.QualificationData(AddInSegmentType.AddIn)("Isolation").Equals("NewProcess") Then
    ' Create an external process.
    Dim external As AddInProcess = New AddInProcess

    ' Activate an add-in in an automatically generated
    ' application domain with a full trust security level.
    Dim CalcAddin5 As Calculator = _
        selectedToken.Activate(Of Calculator)(external, _
            AddInSecurityLevel.FullTrust)
    Console.WriteLine("Add-in activated per qualification data.")
Else
    Console.WriteLine("This add-in is not designated to be activated in a new process.")
End If

注解

使用此属性可获取已应用到具有QualificationDataAttribute属性的管线段的数据。Use this property to obtain data that has been applied to pipeline segments with the QualificationDataAttribute attribute. 您可以使用此数据来标识和使用构成管道的类型。You can use this data to identify and work with the types that compose your pipelines.

此属性返回字典字典。This property returns a dictionary of dictionaries. 顶部字典始终包含六个键。The top dictionary always has six keys. 每个键都AddInSegmentType是管道中段的值。Each key is an AddInSegmentType value for a segment in the pipeline. 每个值都是IDictionary<TKey,TValue>字符串的泛型, 其中包含段的限定数据。Each value is a generic IDictionary<TKey,TValue> of strings with string keys that contains the segment's qualification data.

这些内部字典的键和值是在段的QualificationDataAttribute特性中指定的名称和值。The keys and values of these inner dictionaries are the names and values specified in the QualificationDataAttribute attributes for the segments. 如果没有对段应用任何限定数据, 则其字典为空。If no qualification data has been applied to a segment, its dictionary is empty.

备注

外接程序模型不使用应用于外接程序的宿主视图的限定数据。The add-in model does not use qualification data that is applied to the host view of the add-in. 因此, 字典AddInSegmentType.HostViewOfAddIn始终为空。As a result, the dictionary for AddInSegmentType.HostViewOfAddIn is always empty.

或者, 你可以AddInToken通过使用foreach语句 (在 Visual Basic 中for each , 在视觉对象C++中) QualificationDataItem使用语句 (For Each在中为) 来枚举作为结构集合的来获取限定数据。Alternatively, you can obtain qualification data by enumerating an AddInToken as if it were a collection of QualificationDataItem structures, using a foreach statement (For Each in Visual Basic, for each in Visual C++). 请参阅为QualificationDataItem结构提供的示例。See the example provided for the QualificationDataItem structure.

适用于