You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ibatis.apache.org by "Roaan Vos (JIRA)" <ib...@incubator.apache.org> on 2007/07/30 23:22:53 UTC

[jira] Created: (IBATISNET-234) typeAlias does not work for generics with 2 or more generic parameters

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

                 Key: IBATISNET-234
                 URL: https://issues.apache.org/jira/browse/IBATISNET-234
             Project: iBatis for .NET
          Issue Type: Bug
          Components: DataMapper
    Affects Versions: DataMapper 1.6.1
         Environment: .Net 2
            Reporter: Roaan Vos
            Priority: Minor


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

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (IBATISNET-234) typeAlias does not work for generics with 2 or more generic parameters

Posted by "Gilles Bayon (JIRA)" <ib...@incubator.apache.org>.
     [ https://issues.apache.org/jira/browse/IBATISNET-234?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gilles Bayon closed IBATISNET-234.
----------------------------------

       Resolution: Fixed
    Fix Version/s: DataMapper 1.6.2
         Assignee: Gilles Bayon

In SVN

> typeAlias does not work for generics with 2 or more generic parameters
> ----------------------------------------------------------------------
>
>                 Key: IBATISNET-234
>                 URL: https://issues.apache.org/jira/browse/IBATISNET-234
>             Project: iBatis for .NET
>          Issue Type: Bug
>          Components: DataMapper
>    Affects Versions: DataMapper 1.6.1
>         Environment: .Net 2
>            Reporter: Roaan Vos
>            Assignee: Gilles Bayon
>            Priority: Minor
>             Fix For: DataMapper 1.6.2
>
>
> 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

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.