You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ibatis.apache.org by "Gilles Bayon (JIRA)" <ib...@incubator.apache.org> on 2005/02/17 21:43:51 UTC
[jira] Closed: (IBATISNET-25) Error applying ResultMap when using 'Guid' in resultClass
[ http://issues.apache.org/jira/browse/IBATISNET-25?page=history ]
Gilles Bayon closed IBATISNET-25:
---------------------------------
Resolution: Fixed
Fix Version: DataMapper 1.2
> Error applying ResultMap when using 'Guid' in resultClass
> ---------------------------------------------------------
>
> Key: IBATISNET-25
> URL: http://issues.apache.org/jira/browse/IBATISNET-25
> Project: iBatis for .NET
> Type: Bug
> Versions: DataMaper 1.5, DataAccess 1.5
> Reporter: Henrik Uffe Jensen
> Fix For: DataMapper 1.2
>
> Ran into a few other problems using 'Guid' in resultClass of a statement.
> IBatisNet.DataMapper.Configuration.Statements.CreateInstanceOfResultClass() contains
> the lines:
> if (_resultClass.GetType() == typeof(Guid))
> {
> return Guid.NewGuid();
> }
> but they doesn't work as expected. A 'Guid' resultClass has a System.RuntimeType as type so the Guid.NewGuid() isn't used. I instead did the following using the FullName of the resultClass and the string representation of the type.
> if (_resultClass.FullName == typeof(Guid).ToString())
> {
> return Guid.NewGuid();
> }
> Next thing then in IBatisNet.DataMapper.MappedStatements.ApplyResultMap, just below the above method is called, then the following lines is being used to check if resultClass is a primitive type. However Type.GetTypeCode() with a 'Guid' type returns TypeCode.Object and therefore goes further on.
> // Check if the ResultClass is a 'primitive' Type
> if (Type.GetTypeCode(outObject.GetType()) != TypeCode.Object)
> I changed the code to be
> // Check if the ResultClass is a 'primitive' Type or a Guid
> if (Type.GetTypeCode(outObject.GetType()) != TypeCode.Object || outObject.GetType() == typeof(Guid))
> This works fine for 'Guid' then. I haven't looked into if other datatypes need the same special handling as Guid
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira