ibatis-user-cs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Schall <mike.sch...@gmail.com>
Subject TypeHandlers for "System.Nullable(Of" fails with custom types
Date Mon, 02 Jan 2006 04:28:34 GMT
I am trying to get generics to work using custom type handlers.  I have 
it working with simple "known" types.  For example, adding a handler for 
a Nullable(Of DateTime) would look something like this...

<typeHandler

type="System.Nullable`1[[System.DateTime]]"

      dbType="datetime"

      
callback="ATG.Database.TypeHandlers.NullableDateTimeTypeHandlerCallback, 
ATG.Database"/>
 

This works great.  If you have to further specify the generic type, 
ibatis runs into problems.  For example

<typeHandler

      type="System.Nullable`1[[ATG.Money, ATG.Money]]"

      
callback="ATG.Database.TypeHandlers.NullableMoneyTypeHandlerCallback, 
ATG.Database"/> 

This fails inside the function SplitTypeAndAssemblyNames.  The function 
simply splits on the ',' to find the dll to load.  If I change this 
function to check if it is a generic type string it works fine.

      if (typeAssemblyIndex < 0 || originalTypeName.Contains("`1[[")) 

Is there an issue doing this?  If not can it be added to the core code?

Thanks
Michael

Mime
View raw message