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>

지속성 저장소에서 로드된 읽기-쓰기 값입니다. 이 사전은 가장 최근의 지속성 에피소드에 유지되는 읽기-쓰기 값의 사전에 해당합니다.

예제

다음 코드 샘플에서는 파생되는 클래스에서 PublishValues를 사용하는 방법을 보여 줍니다 PersistenceParticipant. 이 예제는 지속성 참가자 샘플에서 가져옵니다.

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

적용 대상