Introduction
In this blog we will see how to perform select operation using executestorequery.
Program.cs
- using System;
- using System.Collections.Generic;
- using System.Data.Entity.Infrastructure;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ExecuteStoreQuery_Select
- {
- class Program
- {
- static void Main(string[] args)
- {
- EmployeeEntities _dataContext = new EmployeeEntities();
- foreach(var r in (_dataContext as IObjectContextAdapter).ObjectContext.ExecuteStoreQuery < Employee > ("spSelectEmployee")) {
- Console.WriteLine(r);
- }
- Console.ReadKey();
- }
- }
- }
Summary
In this blog we have seen how we can perform select operation using executestorequery. Happy coding!