Skip to content

Instantly share code, notes, and snippets.

@kiyokura
Last active December 29, 2015 21:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kiyokura/7730436 to your computer and use it in GitHub Desktop.
Save kiyokura/7730436 to your computer and use it in GitHub Desktop.
DapperでIN句にさくっとリストをバインドする
cn.Open();
var param = new
{
// IN句に並べたい値をリストとして積んでやる
AgeList = new List<int>() { 20, 38 }
};
var ret = cn.Query<UserEntity>("SELECT * FROM Users WHERE Age IN @AgeList ORDER BY ID", param).ToList();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment