示例#1
0
 public static void Test_Serialize_03(DictionaryRepresentation dictionaryRepresentation)
 {
     Trace.WriteLine("BsonPBSerializationProvider.RegisterProvider()");
     BsonPBSerializationProvider.RegisterProvider();
     PBDictionarySerializer.RegisterGenericDictionarySerializer();
     try
     {
         PBDictionarySerializer.DefaultDictionaryRepresentation = dictionaryRepresentation;
         Test_Bson_Class_02 test     = Create_Test_Bson_Class_02();
         BsonDocument       document = test.zToBsonDocument();
         Trace.WriteLine(document.zToJson());
     }
     finally
     {
         Trace.WriteLine("BsonPBSerializationProvider.UnregisterProvider()");
         BsonPBSerializationProvider.UnregisterProvider();
         PBDictionarySerializer.UnregisterGenericDictionarySerializer();
     }
 }
示例#2
0
 public static void Test_Serialize_04(DictionaryRepresentation dictionaryRepresentation)
 {
     Trace.WriteLine("BsonPBSerializationProvider.RegisterProvider()");
     BsonPBSerializationProvider.RegisterProvider();
     PBDictionarySerializer.RegisterGenericDictionarySerializer();
     try
     {
         //PBDictionarySerializer.DefaultDictionaryRepresentation = dictionaryRepresentation;
         DictionarySerializationOptions options = new DictionarySerializationOptions(dictionaryRepresentation);
         Dictionary <string, ZValue>    infos2  = Create_Dictionary_string_ZValue_01();
         //BsonDocument document = infos2.zToBsonDocument(options);
         //Trace.WriteLine(document.zToJson());
         Trace.WriteLine("dictionaryRepresentation : {0}", dictionaryRepresentation);
         string json = infos2.ToJson(options);
         Trace.WriteLine(json);
     }
     finally
     {
         Trace.WriteLine("BsonPBSerializationProvider.UnregisterProvider()");
         BsonPBSerializationProvider.UnregisterProvider();
         PBDictionarySerializer.UnregisterGenericDictionarySerializer();
     }
 }