Skip to main content

DynamicParameters

A bag of parameters that can be passed to the Dapper Query and Execute methods

Assembly: ServiceStack.OrmLite.dll​
View Source​
Declaration
public class DynamicParameters : object, SqlMapper.IParameterLookup, SqlMapper.IParameterCallbacks, SqlMapper.IDynamicParameters

Properties​

SqlMapper.IParameterLookup.Item[String]​

View Source​
Declaration
object SqlMapper.IParameterLookup.this[string name] { get; }

RemoveUnused​

If true, the command-text is inspected and only values that are clearly used are included on the connection

View Source​
Declaration
public bool RemoveUnused { get; set; }

ParameterNames​

All the names of the param in the bag, use Get to yank them out

View Source​
Declaration
public IEnumerable<string> ParameterNames { get; }

Methods​

AddDynamicParams(Object)​

Append a whole object full of params to the dynamic EG: AddDynamicParams(new {A = 1, B = 2}) // will add property A and B to the dynamic

View Source​
Declaration
public void AddDynamicParams(object param)
Parameters​
TypeName
System.Objectparam

Add(String, Object, Nullable<DbType>, Nullable<ParameterDirection>, Nullable<Int32>)​

Add a parameter to this dynamic parameter list.

View Source​
Declaration
public void Add(string name, object value, DbType? dbType, ParameterDirection? direction, int? size)
Parameters​
TypeNameDescription
System.StringnameThe name of the parameter.

| | System.Object | value | The value of the parameter.

| | System.Nullable<DbType> | dbType | The type of the parameter.

| | System.Nullable<ParameterDirection> | direction | The in or out direction of the parameter.

| | System.Nullable<System.Int32> | size | The size of the parameter.

|

Add(String, Object, Nullable<DbType>, Nullable<ParameterDirection>, Nullable<Int32>, Nullable<Byte>, Nullable<Byte>)​

Add a parameter to this dynamic parameter list.

View Source​
Declaration
public void Add(string name, object value = null, DbType? dbType = null, ParameterDirection? direction = null, int? size = null, byte? precision = null, byte? scale = null)
Parameters​
TypeNameDescription
System.StringnameThe name of the parameter.

| | System.Object | value | The value of the parameter.

| | System.Nullable<DbType> | dbType | The type of the parameter.

| | System.Nullable<ParameterDirection> | direction | The in or out direction of the parameter.

| | System.Nullable<System.Int32> | size | The size of the parameter.

| | System.Nullable<System.Byte> | precision | The precision of the parameter.

| | System.Nullable<System.Byte> | scale | The scale of the parameter.

|

SqlMapper.IDynamicParameters.AddParameters(IDbCommand, SqlMapper.Identity)​

View Source​
Declaration
void SqlMapper.IDynamicParameters.AddParameters(IDbCommand command, SqlMapper.Identity identity)
Parameters​
TypeName
IDbCommandcommand
ServiceStack.OrmLite.Dapper.SqlMapper.Identityidentity

AddParameters(IDbCommand, SqlMapper.Identity)​

Add all the parameters needed to the command just before it executes

View Source​
Declaration
protected void AddParameters(IDbCommand command, SqlMapper.Identity identity)
Parameters​
TypeNameDescription
IDbCommandcommandThe raw command prior to execution

| | ServiceStack.OrmLite.Dapper.SqlMapper.Identity | identity | Information about the query

|

Get<T>(String)​

Get the value of a parameter

View Source​
Declaration
public T Get<T>(string name)
Returns​

<T>: The value, note DBNull.Value is not returned, instead the value is returned as null

Parameters​
TypeName
System.Stringname
Type Parameters​
  • T

Output<T>(T, Expression<Func<T, Object>>, Nullable<DbType>, Nullable<Int32>)​

Allows you to automatically populate a target property/field from output parameters. It actually creates an InputOutput parameter, so you can still pass data in.

View Source​
Declaration
public DynamicParameters Output<T>(T target, Expression<Func<T, object>> expression, DbType? dbType = null, int? size = null)
Returns​

ServiceStack.OrmLite.Dapper.DynamicParameters: The DynamicParameters instance

Parameters​
TypeNameDescription
<T>targetThe object whose property/field you wish to populate.

| | Expression<Func<<T>,System.Object>> | expression | A MemberExpression targeting a property/field of the target (or descendant thereof.)

| | System.Nullable<DbType> | dbType |

| | System.Nullable<System.Int32> | size | The size to set on the parameter. Defaults to 0, or DbString.DefaultLength in case of strings.

|

Type Parameters​
  • T

SqlMapper.IParameterCallbacks.OnCompleted()​

View Source​
Declaration
void SqlMapper.IParameterCallbacks.OnCompleted()

Implements​