I make use of ASP.NET 5 Areas.
In the default ASP.NET 5 project you have _ValidationScriptsPartial.cshtml
in the Views\Shared
folder
I can refer to it in my Areas\AreaName\Views\controllername\MyView.cshtml
as
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
Questions:
Why can I refer to its path directly and not be forced to use
@{await Html.RenderPartialAsync("~/Views/Shared/_ValidationScriptsPartial.cshtml"}
I ask because it is sometimes confusing where it comes from as it is not an relative path. Is there a setting somewhere to enable/disable this behavior.
I have various of my own scripts in location in
Views\Shared
as well as in my area's view folderAreas\MyArea\Views\MyControllerName\
. If I have the same partial view name as in theViews\Shared
folder will it take precendence?Is there a way to make the location strongly typed (i.e. give build error if not exist) or is using C# constants the best way around this? e.g.
@{ await Html.RenderPartialAsync("_ValidationScriptsPartialNotExist"); }
does not give an error or warning or red line underneath