我正在 dapper 中进行一些编码,我收到错误No mapping exists from object type to a known managed provider native type此错误发生在myfriends var for dapper 上。我正在使用 dapper 从表中获取 INT 值列表,然后将它们与另一个进行比较.. 这是给我该错误的代码
int myid = Convert.ToInt32(User.Identity.Name);
// The var myfriend is giving me that error above
var myfriends = sqlConnection.Query<friend>("Select otherfriendsID from friends where profileID=@myidd", new { myidd = myid }).ToList();
var profiles = sqlConnection.Query<profile>("Select top 40 * from profiles where photo is not null AND profileID=@friendship order by profileID desc", new {friendship=myfriends}).ToList();
但是,如果我使用实体一切正常,例如下面的代码可以工作..
var myfriends = (from s in db.friends where s.profileID == myid select s.otherfriendsID).ToList();
这里可能发生什么..