DapperLib / DapperLib/Dapper

Stored procedure - dbType:System.Date - Always Encrypted bug

Open
#585 3 comments 0 reactions 1 assignee View on GitHub

@mgravell is already working on this.

Since Jun 1, 2017.

Dominant language
C#
Stars
18.4k
Forks
3.7k
Avg merge
5h 8m
Merged PRs (30d)
1

Description

We are using SQL Server 2016 with Always Encrypted for a few columns. One of the column types is date . When trying to execute a stored procedure, we get the following error. Switching the column to Datetime (or Datetime2) works. Using ADO instead of Dapper works fine with the column type of date

//Add the paramter
parameters.Add("@DATE_OF_BIRTH",dob,dbType:DbType.Date);

Actual Error

"Message": "No mapping exists from object type System.Date to a known managed provider native type.",
  "Params": {
    "StackTrace": "   at System.Data.SqlClient.MetaType.GetMetaTypeFromValue(Type dataType, Object value, Boolean inferLen, Boolean streamAllowed)\r\n   at System.Data.SqlClient.SqlParameter.GetMetaTypeOnly()\r\n   at System.Data.SqlClient.SqlParameter.get_DbType()\r\n   at Dapper.DynamicParameters.AddParameters(IDbCommand command, Identity identity) in

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.