DynamicParameters
A bag of parameters that can be passed to the Dapper Query and Execute methods
Assembly: ServiceStack.OrmLite.dll
View Source
public class DynamicParameters : object, SqlMapper.IParameterLookup, SqlMapper.IParameterCallbacks, SqlMapper.IDynamicParameters
Properties
SqlMapper.IParameterLookup.Item[String]
View Source
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
public bool RemoveUnused { get; set; }
ParameterNames
All the names of the param in the bag, use Get to yank them out
View Source
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
public void AddDynamicParams(object param)
Parameters
Type | Name |
---|---|
System.Object | param |
Add(String, Object, Nullable<DbType>, Nullable<ParameterDirection>, Nullable<Int32>)
Add a parameter to this dynamic parameter list.
View Source
public void Add(string name, object value, DbType? dbType, ParameterDirection? direction, int? size)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The 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
public void Add(string name, object value = null, DbType? dbType = null, ParameterDirection? direction = null, int? size = null, byte? precision = null, byte? scale = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The 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
void SqlMapper.IDynamicParameters.AddParameters(IDbCommand command, SqlMapper.Identity identity)
Parameters
Type | Name |
---|---|
IDbCommand | command |
ServiceStack.OrmLite.Dapper.SqlMapper.Identity | identity |
AddParameters(IDbCommand, SqlMapper.Identity)
Add all the parameters needed to the command just before it executes
View Source
protected void AddParameters(IDbCommand command, SqlMapper.Identity identity)
Parameters
Type | Name | Description |
---|---|---|
IDbCommand | command | The 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
public T Get<T>(string name)
Returns
<T>
: The value, note DBNull.Value is not returned, instead the value is returned as null
Parameters
Type | Name |
---|---|
System.String | name |
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
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
Type | Name | Description |
---|---|---|
<T> | target | The 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
void SqlMapper.IParameterCallbacks.OnCompleted()