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

typeAlias does not work for generics with 2 or more generic parameters

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • DataMapper 1.6.1
    • DataMapper 1.6.2
    • DataMapper
    • None
    • .Net 2

    Description

      The typeresolver does not work with generic types that takes 2 (or more) generic parameters.
      The problem lies in the "SplitTypeAndAssemblyNames" method of the "TypeAssemblyInfo" class.

      The follow is a fix

      ================ CUT ==========================
      private void SplitTypeAndAssemblyNames(string originalTypeName)
      {
      if (originalTypeName.StartsWith(TypeAssemblyInfo.NULLABLE_TYPE))
      {
      int typeAssemblyIndex = originalTypeName.LastIndexOf(TypeAssemblyInfo.NULLABLE_TYPE_ASSEMBLY_SEPARATOR);
      if (typeAssemblyIndex < 0)

      { _unresolvedTypeName = originalTypeName; }
      else
      { _unresolvedTypeName = originalTypeName.Substring(0, typeAssemblyIndex + 2).Trim(); _unresolvedAssemblyName = originalTypeName.Substring(typeAssemblyIndex + 3).Trim(); }
      }
      else
      {
      int typeAssemblyIndex = originalTypeName.LastIndexOf(TYPE_ASSEMBLY_SEPARATOR);
      if (typeAssemblyIndex < 0)
      { _unresolvedTypeName = originalTypeName; }

      else

      { _unresolvedTypeName = originalTypeName.Substring(0, typeAssemblyIndex).Trim(); _unresolvedAssemblyName = originalTypeName.Substring(typeAssemblyIndex + 1).Trim(); }

      }
      }
      ======================= CUT =========================

      Note that I changed the ".IndexOf(TYPE_ASSEMBLY_SEPARATOR)" to
      ".LastIndexOf(TYPE_ASSEMBLY_SEPARATOR)"

      Not a brilliant fix, but I think it will do

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: