none
SyncKnowledge new instance RRS feed

  • Question

  • I want to create a new SyncKnowledge  object.

    I am using the KnowledgeFragmentBuilder. The problem is that the builder adds a empty scope range set.

     Code:

     KnowledgeFragmentBuilder builder = new KnowledgeFragmentBuilder(format, syncIdNew);            
     builder.ReplicaKeyMap.FindOrAddReplicaKey(syncIdNew);

     ClockVector vectorNow = new ClockVector();
     ClockVectorElement elementNow = new ClockVectorElement(1, tsMaxTs);
     vectorNow.Add(elementNow);
     Range newRange = new Range(idRange, vectorNow);

    builder.ScopeRangeSet.AppendRange(newRange);

     scopeKnowledge = builder.BuildSyncKnowledge();

    The result is that:

    scopeKnowledge    {ReplicaKeyMap: [(0:97171d0a86da43219b4fcffa7da54f20) (1:74adea5c350d42a9b59dbdf025a62a1d)] ScopeRangeSet: [000000000000000000000000000000000000000000000000:[], 030000000000000000000000000000000000000000000000:[(1:3024405)]]}    Microsoft.Synchronization.SyncKnowledge

    The empty range set is boldet.Why does it add a empty Range set??

    Why i am building new SyncKnowledge. Becuse the serialization to file is not working. It is doing the same it is adding a empty scope range after the deserialization from the file.

    code for serialization:

    XmlWriterSettings sett = new XmlWriterSettings();
    sett.ConformanceLevel = ConformanceLevel.Auto;
    using (XmlWriter writer = XmlWriter.Create("scopeKnowledge.xml", sett))
    {
        System.Xml.Serialization.XmlSerializer x = new System.Xml.Serialization.XmlSerializer(scopeKnowledge.GetType());
        x.Serialize(writer, scopeKnowledge);
    }
    using (XmlReader reader = XmlReader.Create("scopeKnowledge.xml", stRead))
    {
           System.Xml.Serialization.XmlSerializer x = new System.Xml.Serialization.XmlSerializer(scopeKnowledge.GetType());
           scopeKnowledge = x.Deserialize(reader) as SyncKnowledge;
    }

    Result:

    copeRangeSet: [000000000000000000000000000000000000000000000000:[], 030000000000000000000000000000000000000000000000:[(1:3024405)]]} 

    Please help.

    Saturday, September 29, 2012 3:51 PM