Merge pull request #1436 from esdrubal/readerwriterlockslim
[mono.git] / mcs / class / System.Web.Mvc3 / Mvc / ViewResult.cs
1 namespace System.Web.Mvc {
2     using System;
3     using System.Globalization;
4     using System.Text;
5     using System.Web.Mvc.Resources;
6
7     public class ViewResult : ViewResultBase {
8         private string _masterName;
9
10         public string MasterName {
11             get {
12                 return _masterName ?? String.Empty;
13             }
14             set {
15                 _masterName = value;
16             }
17         }
18
19         protected override ViewEngineResult FindView(ControllerContext context) {
20             ViewEngineResult result = ViewEngineCollection.FindView(context, ViewName, MasterName);
21             if (result.View != null) {
22                 return result;
23             }
24
25             // we need to generate an exception containing all the locations we searched
26             StringBuilder locationsText = new StringBuilder();
27             foreach (string location in result.SearchedLocations) {
28                 locationsText.AppendLine();
29                 locationsText.Append(location);
30             }
31             throw new InvalidOperationException(String.Format(CultureInfo.CurrentCulture,
32                 MvcResources.Common_ViewNotFound, ViewName, locationsText));
33         }
34     }
35 }