PersistenceParticipant.PublishValues(IDictionary<XName,Object>) メソッド

定義

ホストはこのメソッドを呼び出し、 InstanceData コレクションに読み込まれたすべての値 ( LoadWorkflowCommand または LoadWorkflowByInstanceKeyCommandで入力) をディクショナリ パラメーターとして渡します。

protected:
 virtual void PublishValues(System::Collections::Generic::IDictionary<System::Xml::Linq::XName ^, System::Object ^> ^ readWriteValues);
protected virtual void PublishValues(System.Collections.Generic.IDictionary<System.Xml.Linq.XName,object> readWriteValues);
abstract member PublishValues : System.Collections.Generic.IDictionary<System.Xml.Linq.XName, obj> -> unit
override this.PublishValues : System.Collections.Generic.IDictionary<System.Xml.Linq.XName, obj> -> unit
Protected Overridable Sub PublishValues (readWriteValues As IDictionary(Of XName, Object))

パラメーター

readWriteValues
IDictionary<XName,Object>

永続化ストアから読み込まれた読み取り/書き込み値。 このディクショナリは、最新の永続化エピソードで永続化された読み取り/書き込み値のディクショナリに対応します。

次のコード サンプルでは、 PersistenceParticipantから派生するクラスで PublishValues を使用する方法を示します。 この例は、 永続化の参加者 のサンプルからのものです。

public class StepCountExtension : PersistenceParticipant
{
    static XNamespace stepCountNamespace = XNamespace.Get("urn:schemas-microsoft-com:Microsoft.Samples.WF/WorkflowInstances/properties");
    static XName currentCountName = stepCountNamespace.GetName("CurrentCount");

    int currentCount;

    public int CurrentCount
    {
        get
        {
            return this.currentCount;
        }
    }

    internal void IncrementStepCount()
    {
        this.currentCount += 1;
    }

    protected override void CollectValues(out IDictionary<XName, object> readWriteValues, out IDictionary<XName, object> writeOnlyValues)
    {
        readWriteValues = new Dictionary<XName, object>(1) { { currentCountName, this.currentCount } };
        writeOnlyValues = null;
    }

    protected override void PublishValues(IDictionary<XName, object> readWriteValues)
    {
        object loadedData;
        if (readWriteValues.TryGetValue(currentCountName, out loadedData))
        {
            this.currentCount = (int)loadedData;
        }
    }
}

適用対象