I investigated it a bit more, and it looks like there is no way of doing
this without creating a separate dialect for SQL CE that depends on SQL CE.
Since we don't want NHibernate to have a dependency on SQL CE, we need a new
project for that. Would you be interested in turning this into one of our
Contrib projects?


On Wed, Sep 17, 2008 at 10:29 PM, Artur <[EMAIL PROTECTED]> wrote:

>
> OK, I have a workaround for this bug. It works for me.
>
> Create a new driver and make it derive from actual SqlServerCeDriver
> like so:
>
> using System.Data;
> using System.Data.SqlServerCe;
> using NHibernate.SqlTypes;
>
> namespace MyNamespace
> {
>        public class SqlServerCeDriver : NHibernate.Driver.SqlServerCeDriver
>        {
>                protected override void InitializeParameter(IDbDataParameter
> dbParam, string name, SqlType sqlType)
>                {
>                        base.InitializeParameter(dbParam, name, sqlType);
>
>                        if (sqlType is BinarySqlType)
>                        {
>                                var parameter = (SqlCeParameter) dbParam;
>                                parameter.SqlDbType = SqlDbType.Image;
>                        }
>                }
>        }
> }
>
> Use this driver instead of NH's one.
> What I do here is I override every BinarySqlType parameter with
> SqlDbType.Image type.
> I can get away with it, because in my schema I have no ordinary
> VARBINARY columns, only IMAGE columns. (And of course I reference
> SqlServerCe assembly in my project, NHibernate avoids that with
> reflection)
>
> Problems (bugs?) on NH's side:
>  - sqlType is BinarySqlType and not BinaryBlobSqlType even though the
> associated property is defined as BinaryBlob in hbm.xml mapping file.
>  - sqlType has no length defined (Length==0, LengthDefined==false)
> even though it has length defined in mapping file.
>
>
> Hope this will help somebody.
>
> Regards
> Artur
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to