The source where apply the workaround is a specific drive and not DriverBase (you can inherit from SqlClientDriver).
On Tue, Jun 22, 2010 at 7:07 PM, Fabio Maulo <[email protected]> wrote: > The place for issues and patchs is > http://216.121.112.228/browse/NH > > > On Tue, Jun 22, 2010 at 7:02 PM, Victor H. Maksimenko < > [email protected]> wrote: > >> Hello all, >> >> I've been using nhibernate trunk for a while without problems so far. >> >> Two issues that I've found so far are: >> >> 1) When trying to serialize the configuration (using a method similar >> to >> http://nhforge.org/blogs/nhibernate/archive/2009/03/13/an-improvement-on-sessionfactory-initialization.aspx >> ) and one of the property mappings is using the 'ReadOnlyAccessor' it >> throws because that class is not marked as Serializable... I've posted >> a patch here: http://pastebin.com/Emquf8Jg that adds the serializable >> attribute to the ReadOnlyAccesor and the private NoopSetter class, and >> with that, the configuration gets serialized without problems. >> >> 2) With Sql Server 2008, (using the 2008 dialect), mapping a TimeSpan >> property with TimeAsTimeSpan (with the respective time(x) column in >> the db) works well just for saving/retrieving the value, but as soon >> as I try to query using that field (I've tried using QueryOver<> / >> Criteria, ex: .Where(x => x.TimeSpanProperty == TimeSpan.FromDays(1)) >> or >=, <=, etc, I get db errors like 'time and datetime are >> incompatible in the greater than or equal to operator.', etc...) the >> problem is a bug in the .net System.Data.SqlClient.SqlParameter >> DbType setter (that calls an internal >> MetaType.GetMetaTypeFromDbType(value);) that sets the SqlDbType to >> DateTime instead of time... (you can read more about this bug - and >> it's confirmation - on >> >> http://connect.microsoft.com/VisualStudio/feedback/details/381934/sqlparameter-dbtype-dbtype-time-sets-the-parameter-to-sqldbtype-datetime-instead-of-sqldbtype-time >> ) >> >> I wrote a workaround that 'works for me', you can find the patch here >> (warning: it's as hackish as it can be): http://pastebin.com/S6Tr6Mg0 >> >> I think it'd be better to set the dbParam.Size in the >> SqlClientDriver.cs -> SetDefaultParameterSize or SetParameterSizes >> methods... etc... >> >> It's an ugly workaround but it allows me to save/retrieve & query >> using that field without problems... >> >> I don't know if the NH team is willing to put a workaround in the nh >> code for that .net bug, or maybe should I try using a IUserType that >> forces the SqlDbType to Time in the NullSafeSet method... >> >> Opinions? >> >> Thanks >> >> > > > -- > Fabio Maulo > > -- Fabio Maulo
