Dapper.NET 查詢動態類型


如果不使用泛型類型,也可以動態查詢。

IDBConnection db = /* ... */;
IEnumerable<dynamic> result = db.Query("SELECT 1 as A, 2 as B");

var first = result.First();
int a = (int)first.A; // 1
int b = (int)first.B; // 2