Introduction
This article will show you how to select data using an Entity Framework async call.
Create a console application as in the following figure:

Figure 1: Create console application
Add Entity Framework to project as in Figures 2, 3 and 4.
Figure 2: Add Entity Framework
Figure 3: Choose Connection
Figure 4: Choose Database Object
Program.cs
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Data.Entity;
- using System.Threading.Tasks;
- namespace SelectData_EF_Async
- {
- class Program
- {
- static void Main(string[] args)
- {
- var employee = GetEmployeeData();
- employee.Wait();
- Console.ReadKey();
- }
- public static async Task GetEmployeeData()
- {
- using (var db = new EmployeeDBEntities())
- {
- var query = await (from b in db.Employees
- select b).ToListAsync();
- foreach (var r in query)
- {
- Console.Write(r.FirstName + "\n");
- }
- }
- }
- }
- }
Figure 5: Output of the application
Summary
In this article we saw how to select data using an Entity Framework async call.


Sonu ChaudharyPosted May 26, 2016, 6:39 AM EDT
Good one...
Bhuvanesh MohankumarPosted May 6, 2016, 11:58 AM EDT
Good one...
SharadPosted Jul 21, 2015, 8:35 PM EDT
Excellent..
Musab AlRianiPosted Jun 9, 2015, 5:29 AM EDT
Light and easy to understand,Thank you ??.
Santhakumar MunuswamyPosted Jun 8, 2015, 11:08 AM EDT
Thanks for nice article
Vivek TripathiPosted Jun 8, 2015, 6:25 AM EDT
Good one
Dominique CejaPosted Jun 8, 2015, 3:32 AM EDT
Thanks!
NitinPosted Jun 8, 2015, 12:46 AM EDT
nice
Ayush JaiswalPosted Jun 7, 2015, 8:43 PM EDT
Good