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

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

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.0
    • Affects Version/s: 1.0
    • Component/s: None
    • Labels:
    • Environment:
      Windows

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

      }
      }

            Assignee:
            robert@mongodb.com Robert Stam
            Reporter:
            lbert Luigi Bertazzo
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: