Beispiel #1
0
        private static async Task WriteFruitCountsAsync(IUnitOfWork context)
        {
            Console.WriteLine("Counting Cortland Apples.");
            long cortlandApples = await context.Apples.CountAsync(new CortlandApplesQuery());

            Console.WriteLine($"No. Cortland Apples: {cortlandApples}");

            Console.WriteLine("Retrieving Favourite Bananas.");
            FavouriteBananaTypes favouriteBananaTypes = new FavouriteBananaTypes("Burro", "Lady Finger");
            IEnumerable <Banana> favouriteBananas     = await context.Bananas.QueryAsync(new LadyFingerBananasQuery(favouriteBananaTypes));

            foreach (Banana banana in favouriteBananas.ToList())
            {
                Console.WriteLine($"\tType: {banana.Type} Id: {banana.Id}");
            }
        }
Beispiel #2
0
        private static async Task WriteFruitsAsync(IUnitOfWork context)
        {
            Console.WriteLine("Retrieving Pyrasta Pear");
            Pear pyrastaPear = await context.Pears.FindByIdAsync(_pyrastaPearId.ToString());

            Console.WriteLine($"\tType: {pyrastaPear.Type} Id {pyrastaPear.Id}");

            Console.WriteLine("Retrieving Cortland Apples.");
            IEnumerable <Apple> cortlandApples = await context.Apples.QueryAsync(new CortlandApplesQuery());

            foreach (Apple apple in cortlandApples.ToList())
            {
                Console.WriteLine($"\tType: {apple.Type} Id: {apple.Id}");
            }

            Console.WriteLine("Retrieving Favourite Bananas.");
            FavouriteBananaTypes favouriteBananaTypes = new FavouriteBananaTypes("Burro", "Lady Finger");
            IEnumerable <Banana> favouriteBananas     = await context.Bananas.QueryAsync(new LadyFingerBananasQuery(favouriteBananaTypes));

            foreach (Banana banana in favouriteBananas.ToList())
            {
                Console.WriteLine($"\tType: {banana.Type} Id: {banana.Id}");
            }
        }