DynamicParameters Dapper question

270 views
Skip to first unread message

Derek Beattie

unread,
Jan 8, 2012, 5:33:11 PM1/8/12
to servic...@googlegroups.com
Probably a silly question:

When I use Dapper alone in a console app, .NET 4.0 I'm able to use optional parameters for .Add.

p.Add("@facility_id", 26);

When I try and do this with ServiceStack.Data referenced I can't use optional parameters.  Any idea why?

#if CSHARP30
            string name, object value, DbType? dbType, ParameterDirection? direction, int? size
#else
string name, object value = null, DbType? dbType = null, ParameterDirection? direction = null, int? size = null
#endif

Demis Bellot

unread,
Jan 8, 2012, 5:43:09 PM1/8/12
to servic...@googlegroups.com
Basically ServiceStack binaries are compiled in and can run on .NET 3, so we don't use any .NET 4.0 features.
These are dapper's #defines (i.e. in the original Dapper src) that we ported along with the MiniProfiler port.

If you you want the .NET 4.0 version of Dapper you can add a reference to it on NuGet - Dapper in ServiceStack is purposely put in its own namespace so you can run both side-by-side.

Cjeers.

Derek Beattie

unread,
Jan 8, 2012, 5:49:58 PM1/8/12
to servic...@googlegroups.com
Thanks, I added Dapper from NuGet, works great.
Reply all
Reply to author
Forward
0 new messages