コード例 #1
0
ファイル: EntityFilter.cs プロジェクト: dkkapur/watchdogdemo
        public EntityFilter(WhenToReportEntityHealth whenToReport, bool reportAllApps, ISet <string> appWhitelist)
        {
            this.WhenToReport  = whenToReport;
            this.ReportAllApps = reportAllApps;

            this.AppWhitelist = whenToReport == WhenToReportEntityHealth.Never || reportAllApps
                ? null
                : Guard.IsNotNull(appWhitelist, nameof(appWhitelist));
        }
コード例 #2
0
        private EntityFilter GetEntityHealthFilter(WhenToReportEntityHealth whenToReport, string appWhitelist)
        {
            if (whenToReport == WhenToReportEntityHealth.Never)
            {
                return(new EntityFilter(whenToReport, false, null));
            }

            if (this.IsReportingEnabledForAllApps(appWhitelist))
            {
                return(new EntityFilter(whenToReport, true, null));
            }

            var whitelist = this.GetApplicationWhiteList(appWhitelist);

            return(new EntityFilter(whenToReport, false, whitelist));
        }
コード例 #3
0
        private WhenToReportEntityHealth ParseEnum(string paramValue, string configParamName, WhenToReportEntityHealth defaultValue)
        {
            if (string.IsNullOrEmpty(paramValue))
            {
                return(defaultValue);
            }

            WhenToReportEntityHealth enumValue;

            if (!Enum.TryParse(paramValue, ignoreCase: true, result: out enumValue))
            {
                throw new Exception();
                //throw new ConfigurationErrorsException(
                //    string.Format(
                //        "Invalid value for application parameter {0}. Allowed values are {1}, {2} and {3}",
                //            configParamName,
                //            WhenToReportEntityHealth.Always,
                //            WhenToReportEntityHealth.Never,
                //            WhenToReportEntityHealth.OnWarningOrError));
            }

            return(enumValue);
        }