本文整理汇总了C#中IViewEngine.FindView方法的典型用法代码示例。如果您正苦于以下问题:C# IViewEngine.FindView方法的具体用法?C# IViewEngine.FindView怎么用?C# IViewEngine.FindView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IViewEngine
的用法示例。
在下文中一共展示了IViewEngine.FindView方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindView
private static IView FindView(IViewEngine viewEngine, ActionContext context, string viewName)
{
var result = viewEngine.FindView(context, viewName);
if (!result.Success)
{
var locations = string.Empty;
if (result.SearchedLocations != null)
{
locations = Environment.NewLine +
string.Join(Environment.NewLine, result.SearchedLocations);
}
throw new InvalidOperationException(Resources.FormatViewEngine_ViewNotFound(viewName, locations));
}
return result.View;
}
示例2: FindPartialView
internal static IView FindPartialView(ViewContext viewContext, string partialViewName, IViewEngine viewEngine)
{
ViewEngineResult result = viewEngine.FindView(viewContext, partialViewName).Result;
if (result.View != null)
{
return result.View;
}
StringBuilder locationsText = new StringBuilder();
foreach (string location in result.SearchedLocations)
{
locationsText.AppendLine();
locationsText.Append(location);
}
throw new InvalidOperationException(String.Format(CultureInfo.CurrentCulture,
"MvcResources.Common_PartialViewNotFound", partialViewName, locationsText));
}