다음을 통해 공유


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;
        }
    }
}

적용 대상