-
Notifications
You must be signed in to change notification settings - Fork 0
Async
Marcin Sulecki edited this page Apr 7, 2017
·
2 revisions
private static async Task SaveAlbumsAsyncTest()
{
using (var context = new MusicStoreContext())
{
var album = new Album();
context.Add(album);
await context.SaveChangesAsync();
}
}
private static async Task GetAlbumsAsyncTest()
{
using (var context = new MusicStoreContext())
{
var albums = await context.Albums.ToListAsync();
foreach (var album in albums)
{
Console.WriteLine(album.Title);
}
}
}
<add name="MyConnection"
providerName="System.Data.SqlClient"
connectionString="Data Source=SERVER/SQLSERVER;Initial Catalog=MyDb;Integrated Security=True;MultipleActiveResultSets=True;Asynchronous Processing=True"
/>
http://stackoverflow.com/questions/1642705/sql-server-connection-string-asynchronous-processing-true