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


C# IRequest.FormatActivationPath方法代码示例

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


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

示例1: CouldNotResolvePropertyForValueInjection

        /// <summary>
        /// Generates a message saying that the specified property could not be resolved on the specified request.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <param name="propertyName">The property name.</param>
        /// <returns>The exception message.</returns>
        public static string CouldNotResolvePropertyForValueInjection(IRequest request, string propertyName)
        {
            using (var sw = new StringWriter())
            {
                sw.WriteLine("Error activating {0}", request.Service.Format());
                sw.WriteLine("No matching property {0}.", propertyName);

                sw.WriteLine("Activation path:");
                sw.WriteLine(request.FormatActivationPath());

                sw.WriteLine("Suggestions:");
                sw.WriteLine("  1) Ensure that you have the correct property name.");

                return sw.ToString();
            }
        }
开发者ID:Burr,项目名称:ninject,代码行数:22,代码来源:ExceptionFormatter.cs

示例2: CouldNotUniquelyResolveBinding

        public static string CouldNotUniquelyResolveBinding(IRequest request)
        {
            using (var sw = new StringWriter())
            {
                sw.WriteLine("Error activating {0}", request.Service.Format());
                sw.WriteLine("More than one matching bindings are available.");

                sw.WriteLine("Activation path:");
                sw.WriteLine(request.FormatActivationPath());

                sw.WriteLine("Suggestions:");
                sw.WriteLine("  1) Ensure that you have defined a binding for {0} only once.", request.Service.Format());

                return sw.ToString();
            }
        }
开发者ID:ALyman,项目名称:ninject,代码行数:16,代码来源:ExceptionFormatter.cs

示例3: CouldNotFindScope

        /// <summary>
        /// Generates a message saying that the binding could not be resolved due to unknown scope
        /// </summary>
        /// <param name="request">The request.</param>
        /// <param name="scopeName">Scope name</param>
        /// <returns>The exception message.</returns>
        public static string CouldNotFindScope(IRequest request, string scopeName)
        {
            using (var sw = new StringWriter())
            {
                sw.WriteLine("Error activating {0}", request.Service.Format());
                sw.WriteLine("The scope {0} is not known in the current context.", scopeName);
                sw.WriteLine("No matching scopes are available, and the type is declared InNamedScope({0}).", scopeName);

                sw.WriteLine("Activation path:");
                sw.WriteLine(request.FormatActivationPath());

                sw.WriteLine("Suggestions:");
                sw.WriteLine("  1) Ensure that you have defined the scope {0}.", scopeName);
                sw.WriteLine("  2) Ensure you have a parent resolution that defines the scope.");
                sw.WriteLine("  3) If you are using factory methods or late resolution, check that the correct IResolutionRoot is being used.");

                return sw.ToString();
            }
        }
开发者ID:ninject,项目名称:Ninject.Extensions.NamedScope,代码行数:25,代码来源:ExceptionFormatter.cs

示例4: CouldNotResolveBinding

        public static string CouldNotResolveBinding(IRequest request)
        {
            using (var sw = new StringWriter())
            {
                sw.WriteLine("Error activating {0}", request.Service.Format());
                sw.WriteLine("No matching bindings are available, and the type is not self-bindable.");

                sw.WriteLine("Activation path:");
                sw.WriteLine(request.FormatActivationPath());

                sw.WriteLine("Suggestions:");
                sw.WriteLine("  1) Ensure that you have defined a binding for {0}.", request.Service.Format());
                sw.WriteLine("  2) If the binding was defined in a module, ensure that the module has been loaded into the kernel.");
                sw.WriteLine("  3) Ensure you have not accidentally created more than one kernel.");
                #if !SILVERLIGHT
                sw.WriteLine("  4) If you are using automatic module loading, ensure the search path and filters are correct.");
                #endif

                return sw.ToString();
            }
        }
开发者ID:ALyman,项目名称:ninject,代码行数:21,代码来源:ExceptionFormatter.cs

示例5: CouldNotUniquelyResolveBinding

        /// <summary>
        /// Generates a message saying that the binding could not be uniquely resolved.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <param name="formattedMatchingBindings">The matching bindings, already formatted as strings</param>
        /// <returns>The exception message.</returns>
        public static string CouldNotUniquelyResolveBinding(IRequest request, string[] formattedMatchingBindings)
        {
            using (var sw = new StringWriter())
            {
                sw.WriteLine("Error activating {0}", request.Service.Format());
                sw.WriteLine("More than one matching bindings are available.");

                sw.WriteLine("Matching bindings:");
                for (int i = 0; i < formattedMatchingBindings.Length; i++)
                {
                    sw.WriteLine("  {0}) {1}", i + 1, formattedMatchingBindings[i]);
                }
                sw.WriteLine("Activation path:");
                sw.WriteLine(request.FormatActivationPath());

                sw.WriteLine("Suggestions:");
                sw.WriteLine("  1) Ensure that you have defined a binding for {0} only once.", request.Service.Format());

                return sw.ToString();
            }
        }
开发者ID:LuckyStarry,项目名称:Ninject,代码行数:27,代码来源:ExceptionFormatter.cs


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