Exemplo n.º 1
0
        static void Main(string[] args)
        {
            IEnumerable <StarbuzzData> starbuzzList = GetStarbuzzData();

            string connectionString =
                "Data Source=|DataDirectory|\\ContactDB.sdf";
            ContactDB context = new ContactDB(connectionString);

            var results =
                from starbuzzCustomer in starbuzzList
                where starbuzzCustomer.MoneySpent > 90
                join person in context.People
                on starbuzzCustomer.Name equals person.Name
                select new
            {
                person.Name,
                person.Company,
                starbuzzCustomer.FavoriteDrink
            };

            foreach (var row in results)
            {
                Console.WriteLine("{0} at {1} likes {2}",
                                  row.Name, row.Company, row.FavoriteDrink);
            }

            Console.ReadKey();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            IEnumerable<StarbuzzData> starbuzzList = GetStarbuzzData();

            string connectionString =
                 "Data Source=|DataDirectory|\\ContactDB.sdf";
            ContactDB context = new ContactDB(connectionString);

            var results =
               from starbuzzCustomer in starbuzzList
               where starbuzzCustomer.MoneySpent > 90
               join person in context.People
               on starbuzzCustomer.Name equals person.Name
               select new
               {
                   person.Name,
                   person.Company,
                   starbuzzCustomer.FavoriteDrink
               };

            foreach (var row in results)
                Console.WriteLine("{0} at {1} likes {2}",
                           row.Name, row.Company, row.FavoriteDrink);

            Console.ReadKey();
        }