Skip to content

Dictionary and Object Array Queries

schotime edited this page Apr 23, 2013 · 6 revisions

Sometimes, you don't know the columns that will be returned from a query. This is where being able to map to a Dictionary<string,object>, or object[] comes in handy.

var users = db.Fetch<Dictionary<string, object>>("select * from users");

or

var users = db.Fetch<object[]>("select * from users");

Note: From NPoco version > 1.0.3, all array types (value types eg. string[], int[], double[], DateTime[] etc) will be a valid generic parameter.