Make BsonClassMap<TClass>.MapMember Typesafe

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Won't Fix
    • Priority: Minor - P4
    • None
    • Affects Version/s: 1.5
    • Component/s: Serialization
    • None
    • Environment:
      All
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Right now the BsonClassMap<TClass>.MapMember functionality is cumbersome because the returned type is of type BsonMemberMap rather than BsonMemberMap<TMember>. This forces the user to always recast when dealing with various BsonMemberMap Set methods.

      This is error prone, overly verbose, and violates the design principle of forcing the caller reprovide information that has already been specified.

      Consider the current situation:

      BsonClassMap.RegisterClassMap<MyType>(classMap =>

      { classMap.AutoMap(); classMap.MapMember(myType => myType.MyField) .SetShouldSerializeMethod(obj => !((MyType)obj).MyField != null); }

      );

      Instead it really should be:

      BsonClassMap.RegisterClassMap<MyType>(classMap =>

      { classMap.AutoMap(); classMap.MapMember(myType => myType.MyField) .SetShouldSerializeMethod(myType => myType.MyField != null); }

      );

            Assignee:
            Unassigned
            Reporter:
            Alexander Nagy
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: