当前位置: 首页>>代码示例>>C#>>正文


C# ILogger.WriteWarning方法代码示例

本文整理汇总了C#中ILogger.WriteWarning方法的典型用法代码示例。如果您正苦于以下问题:C# ILogger.WriteWarning方法的具体用法?C# ILogger.WriteWarning怎么用?C# ILogger.WriteWarning使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ILogger的用法示例。


在下文中一共展示了ILogger.WriteWarning方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetScripts

        /// <summary>
        /// Returns a list of all the persistent migration script file paths sorted by name.
        /// </summary>
        public IEnumerable<string> GetScripts(ILogger logger)
        {
            IEnumerable<string> scriptPaths = GetPaths();
            IEnumerable<string> scripts = Enumerable.Empty<string>();

            foreach (var path in scriptPaths)
            {
                if (Directory.Exists(path))
                {
                    scripts = scripts.Union(Directory.GetFiles(path, ScriptFileNamePattern));
                }
                else
                {
                    logger.WriteWarning("WARNING: Persistent migration script directory does not exist.{1}Check the config settings or create the directory. [Path: {0}]", path, Environment.NewLine);
                }
            }

            if (scriptPaths.Count() == 0)
            {
                logger.WriteWarning("WARNING: No persistent migration script paths are defined.{1}Add a '{0}' appSetting with a semicolon delimited list of paths to use.", PerptualMigrationFoldersAppSetting, Environment.NewLine);
            }

            return scripts;
        }
开发者ID:jpoehls,项目名称:dotnetmigrations-contrib,代码行数:27,代码来源:PersistentMigrationScriptLocator.cs

示例2: GetPath

        /// <summary>
        /// Returns the seed script path from the
        /// config file (if available) or the default path.
        /// </summary>
        public string GetPath(ILogger log)
        {
            string path = _configurationManager.AppSettings[AppSettingKeys.SeedFolder];

            if (string.IsNullOrEmpty(path))
            {
                if (log != null)
                {
                    log.WriteWarning(
                        "The " + AppSettingKeys.SeedFolder + " setting was not present in the configuration file so the default " +
                        DefaultSeedScriptPath + " folder will be used instead.");
                }
                path = DefaultSeedScriptPath;
            }

            VerifyAndCreatePath(path);

            return path;
        }
开发者ID:jpoehls,项目名称:dotnetmigrations,代码行数:23,代码来源:SeedDirectory.cs

示例3: ValidateCorrelationId

        protected bool ValidateCorrelationId(AuthenticationExtra extra, ILogger logger)
        {
            var correlationKey = Constants.CorrelationPrefix + BaseOptions.AuthenticationType;

            string correlationCookie;
            if (!Request.GetCookies().TryGetValue(
                correlationKey,
                out correlationCookie))
            {
                logger.WriteWarning(string.Format("{0} cookie not found", correlationKey));
                return false;
            }

            Response.DeleteCookie(correlationKey);

            string correlationExtra;
            if (!extra.Properties.TryGetValue(
                correlationKey,
                out correlationExtra))
            {
                logger.WriteWarning(string.Format("{0} state property not found", correlationKey));
                return false;
            }

            extra.Properties.Remove(correlationKey);

            if (!string.Equals(correlationCookie, correlationExtra, StringComparison.Ordinal))
            {
                logger.WriteWarning(string.Format("{0} correlation cookie and state property mismatch", correlationKey));
                return false;
            }

            return true;
        }
开发者ID:tkggand,项目名称:katana,代码行数:34,代码来源:AuthenticationHandler.cs

示例4: ValidateCorrelationId

        protected bool ValidateCorrelationId(AuthenticationProperties properties, ILogger logger)
        {
            if (properties == null)
            {
                throw new ArgumentNullException("properties");
            }

            string correlationKey = Constants.CorrelationPrefix + BaseOptions.AuthenticationType;

            string correlationCookie = Request.Cookies[correlationKey];
            if (string.IsNullOrWhiteSpace(correlationCookie))
            {
                logger.WriteWarning("{0} cookie not found.", correlationKey);
                return false;
            }

            Response.Cookies.Delete(correlationKey);

            string correlationExtra;
            if (!properties.Dictionary.TryGetValue(
                correlationKey,
                out correlationExtra))
            {
                logger.WriteWarning("{0} state property not found.", correlationKey);
                return false;
            }

            properties.Dictionary.Remove(correlationKey);

            if (!string.Equals(correlationCookie, correlationExtra, StringComparison.Ordinal))
            {
                logger.WriteWarning("{0} correlation cookie and state property mismatch.", correlationKey);
                return false;
            }

            return true;
        }
开发者ID:jizhonglee,项目名称:Security,代码行数:37,代码来源:AuthenticationHandler.cs


注:本文中的ILogger.WriteWarning方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。