Esempio n. 1
0
        private void SetUpDirectory()
        {
            string directory = @"G:\codecamp\Linq\LogFiles";

            _lines = Directory.EnumerateFiles(directory)
                     .SelectMany(path => LinqToText.EnumLines(File.OpenText(path)));
        }
Esempio n. 2
0
        private void SetUpAzureStorage()
        {
            // Retrieve storage account from connection string.
            var connStr = ConfigurationManager.ConnectionStrings["StorageConnectionString"];

            if (connStr == null || string.IsNullOrEmpty(connStr.ConnectionString))
            {
                throw new Exception("StorageConnectionString not configured.");
            }

            CloudStorageAccount storageAccount = CloudStorageAccount.Parse(
                connStr.ConnectionString);

            // Create the blob client.
            CloudBlobClient    blobClient = storageAccount.CreateCloudBlobClient();
            CloudBlobContainer container  = blobClient.GetContainerReference("xdorchard");

            int pathLength = container.Uri.AbsolutePath.Length;

            _lines = container.ListBlobs(null, true)
                     .OfType <CloudBlockBlob>()
                     .AsParallel()
                     .SelectMany(item =>
            {
                string blobAddressUri     = item.Uri.AbsolutePath.Substring(pathLength + 1);
                CloudBlockBlob blockBlob2 = container.GetBlockBlobReference(blobAddressUri);
                StreamReader sr           = new StreamReader(blockBlob2.OpenRead());
                return(LinqToText.EnumLines(sr));
            });
        }
Esempio n. 3
0
        public void Run()
        {
            string directory = @"G:\codecamp\Linq\LogFiles";

            var lines = Directory.EnumerateFiles(directory)
                        .SelectMany(path => LinqToText.EnumLines(File.OpenText(path)));

            //QueryW3SVCLogUsingLinqToText(lines);
            //QueryW3SVCLogUsingLinqToDelimited(lines);
            //QueryW3SVCLogUsingLingToW3SVCLog(lines);
            QueryW3SVCLogUisngSkyLinqQueryable(lines);
        }