v2.6
This release adds extensions to the DbContext that allow anonymous types to be used as the source of parameters for queries. The properties of the objects are converted into Db Parameters, with the property name becoming the Parameter Name and the property value becoming the Value. If a property is a DbParameter (or derived from DbParameter), the name is set from the property name, and the parameter is otherwise used as provided.
The SQL library has been updated with ParameterExtensions that can be used when auto-detection of the parameter type is not available. These methods are meant to be used in conjunction with the anonymous type parameters feature.
Example usage:
string state = "PA";
var cities = connector.Query<City>("select * from Cities where State = @State", new { state });
string name = "Chicago";
var city = connector
.Query<City>("select * from Cities where Name = @Name", new { Name = name.AsNVarCharParam(100) })
.SingleOrDefault();