Skip to content

Instantly share code, notes, and snippets.

@bleroy
Created April 18, 2017 17:07
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 bleroy/231846fad6a2850cf8d731eb4064be28 to your computer and use it in GitHub Desktop.
Save bleroy/231846fad6a2850cf8d731eb4064be28 to your computer and use it in GitHub Desktop.
public class POCO
{
public int Answer { get; set; }
}
//...
var db = DbContext.CreateDbContext(connectionString:
"Data Source=.\\SQL;Initial Catalog=tempdb;Integrated Security=True;Pooling=true;Max Pool Size=3000;");
var ids = await db.QueryAsync("select [Answer] = object_id from sys.objects;");
var pocoArray = ids.ToObjectArray<POCO>();
foreach (var poco in pocoArray)
{
Console.WriteLine(poco.Answer);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment