Adventure.Works.LiveDemo.Startup.QueryTwo C# (CSharp) Метод

QueryTwo() публичный статический Метод

Filter on the server in order to utilize the heavy mathematics and algorithms that work under the hood of SQL Server Also to retrieve less data from the server, because that is an unnecessary overhead
public static QueryTwo ( ) : void
Результат void
        public static void QueryTwo()
        {
            using (var dbContext = new AdventureWorks2014Entities())
            {
                Console.WriteLine("Enter last name to search: ");
                var lastName = Console.ReadLine();

                var people = dbContext.People
                    .Where(x => x.LastName == lastName)
                    .Select(x => x);

                foreach (var person in people)
                {
                    Console.WriteLine(person.BusinessEntityID);
                }
            }
        }