Created
September 20, 2017 05:19
-
-
Save d2funlife/791283390539224c408f56c7ef6cc647 to your computer and use it in GitHub Desktop.
ViewResult
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace System.Web.Mvc | |
{ | |
public class ViewResult : ViewResultBase | |
{ | |
private string _masterName; | |
public string MasterName | |
{ | |
get { return _masterName ?? String.Empty; } | |
set { _masterName = value; } | |
} | |
protected override ViewEngineResult FindView(ControllerContext context) | |
{ | |
ViewEngineResult result = ViewEngineCollection.FindView(context, ViewName, MasterName); | |
if (result.View != null) | |
{ | |
return result; | |
} | |
//генирация исключения со всеми местами, где искали файл представления | |
StringBuilder locationsText = new StringBuilder(); | |
foreach (string location in result.SearchedLocations) | |
{ | |
locationsText.AppendLine(); | |
locationsText.Append(location); | |
} | |
throw new InvalidOperationException(String.Format(CultureInfo.CurrentCulture, | |
MvcResources.Common_ViewNotFound, ViewName, locationsText)); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment