Skip to content

Instantly share code, notes, and snippets.

@kiyokura
Created October 31, 2013 12:47
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/7249116 to your computer and use it in GitHub Desktop.
Save kiyokura/7249116 to your computer and use it in GitHub Desktop.
こんな感じで、Dapper使ってもGlimpse.AdoでトレースOK。
// SQL Server CEで試した例。SQL Serverの場合はプロバイダ名をSystem.Data.SqlClientに。
var factory = System.Data.Common.DbProviderFactories.GetFactory("System.Data.SqlServerCe.4.0");
using (var cn = factory.CreateConnection())
{
cn.ConnectionString = "接続文字列";
cn.Open();
var ret = cn.Query("SELECT * FROM users WHERE Age > @Age", new { Age = 20 });
foreach (var r in ret)
{
// 内容読みだすよ
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment