From: Michael D. <mik...@us...> - 2004-07-19 13:54:32
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Type In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1040/Type Modified Files: NullableType.cs Log Message: Added a catch for InvalidCastException to help catch when people are mapping the wrong db fields to NHibernate Type. This was done to help with figuring out which Type was causing problems with MySql. Index: NullableType.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/NullableType.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** NullableType.cs 10 Feb 2004 18:41:42 -0000 1.7 --- NullableType.cs 19 Jul 2004 13:54:24 -0000 1.8 *************** *** 203,206 **** --- 203,207 ---- public virtual object NullSafeGet(IDataReader rs, string name) { + int index = rs.GetOrdinal(name); *************** *** 214,218 **** else { ! object val = Get(rs, index); if ( log.IsDebugEnabled ) --- 215,229 ---- else { ! object val = null; ! try ! { ! val = Get(rs, index); ! } ! catch(System.InvalidCastException ice) ! { ! throw new ADOException( ! "Could not cast the value in field " + name + " to the Type " + this.GetType().Name + ! ". Please check to make sure that the mapping is correct and that your DataProvider supports this Data Type.", ice); ! } if ( log.IsDebugEnabled ) |