Skip to content

Enhancement: Enable IDbDataParameter as query arguments #1060

@mikependon

Description

@mikependon

Describe the enhancement

As a support the enhancement #1052, it would be great if we can pass the actual IDbDataParameter as a direct value to the target property/columns, so the users have the freedom of all the attributes they would like to pass.

using (var connection = new SqlConnection("..."))
{
     var people = connection.ExecuteQuery<Person>("SELECT * FROM [Person] WHERE (FirstName = @FirstName);",
         new { FirstName = new SqlParameter("_", DbType.String) { Value = "John", SqlDbType = SqlDbType.Text });
}

And below is when querying via fluent methods with QueryField object.

using (var connection = new SqlConnection("..."))
{
     var people = connection.Query<Person>(new QueryField("Name",
         new { FirstName = new SqlParameter("_", DbType.String) { Value = "John", SqlDbType = SqlDbType.Text  });
}

Note: The value of the name passed in the IDbDataParameter object ('_') is not necessary due to the anonymous/QueryField object has a targeted property duing the assignment. Therefore, by default, whatever values passed to this property will be changed prior to the execution.

Additional Context

By having this capability, it will supercede all the configuration and mappings defined for the affected property/column of the entity/table.

Metadata

Metadata

Assignees

Labels

breaking-changesA breaking changes (issue, request, enhancement, etc)enhancementNew feature or requestfixedThe bug, issue, incident has been fixed.todoThings to be done in the future

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions