Hello Mailinglist,

I was trying to use Nhibernate together with Firebird. I tried to use Guids for 
PK values, but had problems. I debugged a little bit, and found this code to be 
incorrect:

FbParameter.cs, Line 340
TypeCode code = Type.GetTypeCode(value.GetType());

Despite the fact that a Guid-value is passed as the commands parameter, the FB 
ADO.NET provider treats it as FbDbType.Binary. Consider this:

Type.GetTypeCode(typeof(Guid)) -> Object

The switch/case assumes the type code for Guid is empty, so it all ends with a 
wrong cast:

Unhandled Exception: NHibernate.ADOException: could not insert: 
[MediaBox.Database.Album#0d6d84e1-eadc-4c15-aea2-95c793b26ec3]
---> System.InvalidCastException: Unable to cast object of type 'System.Guid' 
to type 'System.Byte[]'.
   at FirebirdSql.Data.Firebird.FbCommand.UpdateParameterValues() in 
c:\Data\Devel\NHibernate\NETProvider_17\source\FirebirdSql.Da
ta.Firebird\FbCommand.cs:line 1002

Regards, Alex


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Reply via email to