Hello Fabio - in order to optimize SQL servers usage of executionplans
its actually enough to set the size of the SqlParameter to a fixed
(max) length which is exactly what SetParameterSizes in
SqlClientDriver.cs does.

So you just need to change

                        if (IsPrepareSqlEnabled)
                        {
                                SetParameterSizes(command.Parameters, 
parameterTypes);
                        }

to
                        SetParameterSizes(command.Parameters, parameterTypes);

The only thing is that it does not respect the mapping-configuration
of max sizes for strings unless (you use type="String(100)" for
instance) - but thats a different matter)

Due to this fact, the varchar types of the parameterized queries will
typically be of size 4000 - but that does not harm the executionplans,
so its not a showstopper.

Regards
Carsten Hess


On Apr 2, 3:54 pm, Fabio Maulo <[email protected]> wrote:
> I maen that it is a know "problem".Btw to "optimize" MsSQL plan-choosing you
> should set the IType of each query parameter (really a PITA).
>
> Don't forget to send a mail to MsSQL team.
>
> 2009/4/2 Carsten Hess <[email protected]>
>
>
>
>
>
>
>
> > Hello Fabio,
>
> > Not exactly sure what you mean by that... ?
>
> > But wouldn't you say that
>
> > <property name="Name" type="String(100)">
> > <property name="Name" type="String" length="100">
> > <property name="Name" length="100">   // Type is automatically
> > deducted as string
>
> > Should be read as exactly the same by the mapping parser?
>
> > (And one could argue that there is no need for the syntax "String
> > (100)" when we have the length field).
>
> > Regards
> > Carsten
>
> > On Apr 1, 4:06 pm, Fabio Maulo <[email protected]> wrote:
> > > 2009/4/1 Carsten Hess <[email protected]>
>
> > > > That must be bug / leftover ?
>
> > > We have a specific test about this matter.
>
> > > --
> > > Fabio Maulo
>
> --
> Fabio Maulo
--~--~---------~--~----~------------~-------~--~----~
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