@@ -22,7 +22,6 @@ public CompiledHandlebarsViewEngine(Assembly assembly, CompiledHandlebarsViewEng
22
22
{
23
23
_options = options ;
24
24
25
- //This part is close to magic.
26
25
//The basic idea: Search through the assembly, find all compiled HandlebarsTemplates and create Func<>-objects for their render methods.
27
26
//Wrap these Func<>-objects in a generic class and store it in a Dictionary to be able to access them at runtime
28
27
//Then the View can call the wrapped Func<>-object without knowing the actual type of the viewModel and without using reflection!
@@ -64,6 +63,15 @@ private string GetVirtualPath(Assembly assembly, Type template)
64
63
}
65
64
}
66
65
66
+ /// <summary>
67
+ /// Tries to find a View by name and context (controller and area name)
68
+ /// It uses the viewlocation formats passed in the options to generate possible locations and then looks in the mapping if they exist
69
+ /// First match wins!
70
+ /// </summary>
71
+ /// <param name="context"></param>
72
+ /// <param name="viewName"></param>
73
+ /// <param name="isMainPage"></param>
74
+ /// <returns></returns>
67
75
public ViewEngineResult FindView ( ActionContext context , string viewName , bool isMainPage )
68
76
{
69
77
var controllerName = RazorViewEngine . GetNormalizedRouteValue ( context , ControllerKey ) ;
@@ -78,6 +86,14 @@ public ViewEngineResult FindView(ActionContext context, string viewName, bool is
78
86
}
79
87
}
80
88
89
+ /// <summary>
90
+ /// Tries to find a View by its ViewPath.
91
+ /// Checks if the ViewPath exists in the mappings and then returns the View
92
+ /// </summary>
93
+ /// <param name="executingFilePath"></param>
94
+ /// <param name="viewPath"></param>
95
+ /// <param name="isMainPage"></param>
96
+ /// <returns></returns>
81
97
public ViewEngineResult GetView ( string executingFilePath , string viewPath , bool isMainPage )
82
98
{
83
99
if ( _mappings . ContainsKey ( viewPath . ToLower ( ) ) )
0 commit comments