Exemple #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);

            #if DEBUG
            Console.ReadKey();
            #endif
        }
Exemple #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);
            }

#if DEBUG
            Console.ReadKey();
#endif
        }