开发者

Dapper - like operator using DynamicParameters

开发者 https://www.devze.com 2023-03-20 10:29 出处:网络
This works: var list = conn.Query<int>( \"select Id from Person where Id in @ids\", new { ids = new int[] { 1, 2, 3 } }

This works:

var list = conn.Query<int>(
  "select Id from Person where Id in @ids", 
  new { ids = new int[] { 1, 2, 3 } }
);

This throws "No mapping exists from object type System.Int32[] to a known managed provider native type.":

DynamicParameters param开发者_StackOverfloweters = new DynamicParameters(
  new { ids = new int[] { 1, 2, 3 } }
);
var list2 = conn.Query<int>(
  "select Id from Person where Id in @ids", 
  parameters
);

Any ideas?


Just fixed this issue in the latest dapper (grab from hg), the code used to diverge around the DynamicParameters value extraction. Now the code being run is the same.

0

精彩评论

暂无评论...
验证码 换一张
取 消