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

Cant' map a class with a member of the same Type.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Works as Designed
    • Affects Version/s: 1.0
    • Fix Version/s: 1.0
    • Component/s: None
    • Labels:
    • Environment:
      Windows

      Description

      If a class declare a member of the same class Type you get a mapping error.

      Possible change in BsonClassMap.cs (all tests passed):

      /// <summary>
      /// Registers a class map.
      /// </summary>
      /// <param name="classMap">The class map.</param>
      public static void RegisterClassMap(
      BsonClassMap classMap
      ) {
      lock (BsonSerializer.ConfigLock) {
      // note: class maps can NOT be replaced (because derived classes refer to existing instance)
      // classMaps.Add(classMap.ClassType, classMap); ORIGINAL
      if (!classMaps.ContainsKey(classMap.ClassType))

      { classMaps.Add(classMap.ClassType, classMap); BsonDefaultSerializer.RegisterDiscriminator(classMap.ClassType, classMap.Discriminator); }

      }
      }

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: