PersistenceParticipant.CollectValues 메서드

정의

호스트는 지속할 읽기/쓰기 값과 쓰기 전용 값을 수집하기 위해 사용자 지정 지속성 참석자에 대해 이 메서드를 호출합니다.

protected:
 virtual void CollectValues([Runtime::InteropServices::Out] System::Collections::Generic::IDictionary<System::Xml::Linq::XName ^, System::Object ^> ^ % readWriteValues, [Runtime::InteropServices::Out] System::Collections::Generic::IDictionary<System::Xml::Linq::XName ^, System::Object ^> ^ % writeOnlyValues);
protected virtual void CollectValues (out System.Collections.Generic.IDictionary<System.Xml.Linq.XName,object> readWriteValues, out System.Collections.Generic.IDictionary<System.Xml.Linq.XName,object> writeOnlyValues);
abstract member CollectValues : IDictionary * IDictionary -> unit
override this.CollectValues : IDictionary * IDictionary -> unit
Protected Overridable Sub CollectValues (ByRef readWriteValues As IDictionary(Of XName, Object), ByRef writeOnlyValues As IDictionary(Of XName, Object))

매개 변수

readWriteValues
IDictionary<XName,Object>

지속할 읽기/쓰기 값입니다.

writeOnlyValues
IDictionary<XName,Object>

지속할 쓰기 전용 값입니다.

예제

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

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

설명

호스트는 첫 번째 사전의 읽기/쓰기 값을 InstanceValue 컬렉션의 InstanceData 개체로 패키징하고 두 번째 사전의 쓰기 전용 값을 InstanceValueOptional 플래그가 설정된 WriteOnly 개체로 패키징합니다. 자세한 내용은 InstanceValueOptions를 참조하세요.

중요

한 지속성 에피소드 내의 모든 지속성 참석자에 대해 CollectValues 구현이 제공하는 각 값에는 고유한 XName이 있어야 합니다.

적용 대상