You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-cs@ibatis.apache.org by FMT <fl...@mercer.com> on 2009/12/03 22:25:23 UTC

Does iBatis support generic TypeHandlerCallbacks spanning multiple assemblies?

I'm looking at doing something like this:

public class MyGenericTypeHandlerCallback<T> : ITypeHandlerCallback

then in my sqlmap i want to do:

<alias>
    <typeAlias alias="MySpecialTypeHandler"
type="myFirstNamespace.MyGenericTypeHandlerCallback`1[mysecondNamespace.MySpecialType],
myFirstAssembly"/> 
  </alias>

the key here is that MyGenericTypeHandlerCallback is defined and compiled in
myFirstAssembly, while MySpecialType is defined and compiled in a different
assembly, mySecondAssembly.

So when i try the alias above, iBatis complains (rightfully so) that it
can't find mysecondNamespace.MySpecialType.  It's right to complain since i
did not tell it anything about mySecondAssembly.

so i tried:

<alias>
    <typeAlias alias="MySpecialTypeHandler"
type="myFirstNamespace.MyGenericTypeHandlerCallback`1[mysecondNamespace.MySpecialType,
mySecondAssembly], myFirstAssembly"/> 
  </alias>

but it doesn't like this either.  Any creative idea as to how to make this
work?  For a variety of reasons, i would rather not define the generic
MyGenericTypeHandlerCallback type in the same assembly as MySpecialType.

Any idea is welcome,

thanks.
-- 
View this message in context: http://old.nabble.com/Does-iBatis-support-generic-TypeHandlerCallbacks-spanning-multiple-assemblies--tp26633442p26633442.html
Sent from the iBATIS - User - Cs mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-cs-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-cs-help@ibatis.apache.org


Re: Does iBatis support generic TypeHandlerCallbacks spanning multiple assemblies?

Posted by FMT <fl...@mercer.com>.
Roger, thank you! That did the trick.  All i had to do was double the square
brackets as in:

<alias>
   <typeAlias alias="MySpecialTypeHandler"
type="myFirstNamespace.MyGenericTypeHandlerCallback`1[[mysecondNamespace.MySpecialType,
mySecondAssembly]], myFirstAssembly"/>
 </alias>

I did not have to use the fully qualified name, but it probably wouldn't
hurt :-)

Frankly i'm amazed that iBatis can do this.  Kudos to the iBatis team on
this!

~
-- 
View this message in context: http://old.nabble.com/Does-iBatis-support-generic-TypeHandlerCallbacks-spanning-multiple-assemblies--tp26633442p26634195.html
Sent from the iBATIS - User - Cs mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-cs-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-cs-help@ibatis.apache.org


Re: Does iBatis support generic TypeHandlerCallbacks spanning multiple assemblies?

Posted by Roger Champagne <rc...@gmail.com>.
Hi,

I ran into a similar problem. I believe you have to use the fully qualified
assembly name, with version number and all.

See
http://stackoverflow.com/questions/52989/using-generic-classes-with-objectdatasourcefor
a short code snippet that will allow to get this information for your
specific case. This link deals with ObjectDataSources in ASP pages, but I
used the same thing to get the relevant information for usage in iBatis.

Hope this helps!

Sincerely,

Roger

On Thu, Dec 3, 2009 at 4:25 PM, FMT <fl...@mercer.com> wrote:

>
> I'm looking at doing something like this:
>
> public class MyGenericTypeHandlerCallback<T> : ITypeHandlerCallback
>
> then in my sqlmap i want to do:
>
> <alias>
>    <typeAlias alias="MySpecialTypeHandler"
>
> type="myFirstNamespace.MyGenericTypeHandlerCallback`1[mysecondNamespace.MySpecialType],
> myFirstAssembly"/>
>  </alias>
>
> the key here is that MyGenericTypeHandlerCallback is defined and compiled
> in
> myFirstAssembly, while MySpecialType is defined and compiled in a different
> assembly, mySecondAssembly.
>
> So when i try the alias above, iBatis complains (rightfully so) that it
> can't find mysecondNamespace.MySpecialType.  It's right to complain since i
> did not tell it anything about mySecondAssembly.
>
> so i tried:
>
> <alias>
>    <typeAlias alias="MySpecialTypeHandler"
>
> type="myFirstNamespace.MyGenericTypeHandlerCallback`1[mysecondNamespace.MySpecialType,
> mySecondAssembly], myFirstAssembly"/>
>  </alias>
>
> but it doesn't like this either.  Any creative idea as to how to make this
> work?  For a variety of reasons, i would rather not define the generic
> MyGenericTypeHandlerCallback type in the same assembly as MySpecialType.
>
> Any idea is welcome,
>
> thanks.
> --
> View this message in context:
> http://old.nabble.com/Does-iBatis-support-generic-TypeHandlerCallbacks-spanning-multiple-assemblies--tp26633442p26633442.html
> Sent from the iBATIS - User - Cs mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-cs-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-cs-help@ibatis.apache.org
>
>