Uploaded image for project: 'iBatis for .NET'
  1. iBatis for .NET
  2. IBATISNET-254

Better support for nested result maps when using dictionary

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • DataMapper 1.6.1
    • DataMapper 1.6.2
    • DataMapper
    • None

    Description

      If class for result map is dictionary (or inherits dictionary) it is not
      possible to use nested result maps to put complex objects into dictionary.
      The problem is in ResultProperty.MemberType property. Currently it is
      implemented like this:

      public virtual Type MemberType
      {
      get

      { return _setAccessor.MemberType; }

      }

      But if the class for result map is dictionary, _setAccessor is null then
      this getter is called from Get method of PropertyStrategyFactory class (line
      88). We propose to change it to:

      public virtual Type MemberType
      {
      get
      {
      if (_setAccessor != null)

      { return _setAccessor.MemberType; }

      if (_nestedResultMap != null)

      { return _nestedResultMap.Class; }

      throw new IBatisNetException(
      String.Format(CultureInfo.InvariantCulture,
      "Could not resolve member type for result property '

      {0}

      '. Neither
      nested result map nor typed setter was provided.",
      _propertyName));
      }
      }

      In this case if set accessor is not initialized yet but nested result map is
      set, class from nested result map is used. Maybe this getter can also
      consider CLRType if nothing else is provided.

      Currently we are using 'patched' version of iBATIS but we would like to get
      back to mainline when these issues are fixed.

      Attachments

        Activity

          People

            gilles Gilles Bayon
            gilles Gilles Bayon
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: