예제 #1
0
        private List <StorageWarningModel> AnalyzeMessagesForWarnings(IEnumerable <WindowsAzureStorageTimelineMessage> timelineMessages)
        {
            List <StorageWarningModel> returnValue = new List <StorageWarningModel>();

            // todo: inject inspections so they can be made extensible
            var inspectors = new IWindowsAzureStorageInspector[]
            {
                new GeneralBestPracticesInspector(),
                new TableStorageQueryIndexInspector(),
                new TableStorageEchoContentInspector()
            };

            foreach (var inspector in inspectors)
            {
                var warnings = inspector.Inspect();
                returnValue.AddRange(warnings.Select(m => new StorageWarningModel
                {
                    RequestUrl = "General",
                    Warning    = m
                }));
            }

            foreach (var message in timelineMessages)
            {
                foreach (var inspector in inspectors)
                {
                    var warnings = inspector.Inspect(message);
                    returnValue.AddRange(warnings.Select(m => new StorageWarningModel
                    {
                        RequestUrl = message.Url,
                        Warning    = m
                    }));
                }
            }

            return(returnValue);
        }
예제 #2
0
        private List<StorageWarningModel> AnalyzeMessagesForWarnings(IEnumerable<WindowsAzureStorageTimelineMessage> timelineMessages)
        {
            List<StorageWarningModel> returnValue = new List<StorageWarningModel>();

            // todo: inject inspections so they can be made extensible
            var inspectors = new IWindowsAzureStorageInspector[]
                {
                    new GeneralBestPracticesInspector(),
                    new TableStorageQueryIndexInspector(),
                    new TableStorageEchoContentInspector()
                };

            foreach (var inspector in inspectors)
            {
                var warnings = inspector.Inspect();
                returnValue.AddRange(warnings.Select(m => new StorageWarningModel
                {
                    RequestUrl = "General",
                    Warning = m
                }));
            }

            foreach (var message in timelineMessages)
            {
                foreach (var inspector in inspectors)
                {
                    var warnings = inspector.Inspect(message);
                    returnValue.AddRange(warnings.Select(m => new StorageWarningModel
                    {
                        RequestUrl = message.Url,
                        Warning = m
                    }));
                }
            }

            return returnValue;
        }