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");  
-                 }  
-             }  
-         }  
-     }  
- }   
 The output of the application is as in Figure 5.
 
Figure 5: Output of the application
Summary
In this article we saw how to select data using an Entity Framework async call.