Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-1916

Ability to have 2 different serialization configuration within the same process




      I have a POCO object (ClassA) that is configured with certain Bson attributes for class and properties. Of cause when I save an instance of it to the DB, driver honers all attributes.

      I have another object that is declared as:
      public class EventData
      public Guid Id

      {get; set;}

      public dynamic Details


      I assign ClassA instance to the Details property of the EventData. When I save the EventData to the DB, driver attaches "_t" element as well follows all Bson attributes that ClassA declares, including property name aliases, etc.
      I would like that when ClassA is being saved on its own, driver follows all instructions the Bson attributes provide, but when ClassA is being saved as part of EventData, driver should ignore the Bson attributes declared in ClassA.

      This is similar to providing multiple Property names resolvers to JSON.NET...

      Is this possible to do? If so, how would I do this? Do you plan to add this capability if not yet available?




            • Votes:
              0 Vote for this issue
              2 Start watching this issue


              • Created: