Ejemplo n.º 1
0
        public Task <List <BookRecDTO> > FetchBookDataAsync(string resourceName, bool useSampleData, CancellationToken cancellationToken)
        {
            // Use the default value if no value was provided and
            // remove the .xml extension if included.
            resourceName = NormalizeResourceName(resourceName);

            // Open the XML Data Stream for reading.
            Stream stream = GetXmlDataStream(resourceName, useSampleData);

            // Create an asynchronous task that will...
            // parse the XML data file into a list of BookRecDTO objects.
            CatalogReader             catReader = new CatalogReader();
            Task <List <BookRecDTO> > result    = catReader.FetchBookDataAsync(stream, cancellationToken);

            return(result);
        }