I am interested in changing the structure folder. I have read many articles, but I have not found the solution.
I want to do so to distribute the files and folders on thematic folders. I have created a base class BaseViewEngine from RazorViewEngine
public class BaseViewEngine : RazorViewEngine
{
public BaseViewEngine()
{
MasterLocationFormats = new[]
{
"~/Themes/My/master.cshtml"
};
ViewLocationFormats = new[]
{
"~/Modules/{1}/{0}.cshtml"
};
PartialViewLocationFormats = new[]
{
"~/Blocks/{0}.cshtml"
};
}
}
But it is not working.
Update
Control is primitive. Only for test
public class HomeController : Controller
{
public ActionResult Index()
{
var test = new Test { Text = "Hello" };
return View(test);
}
}
And View
@model DemoModules.Test
<h2>Index</h2>
But when I run project. I Get error
CS0103: The name of the ‘model’ does
not exist in the current context
About structure folder, see the source of subject matter
Take a look at the web.config file in the default Views folder. There’s some stuff in there that is required for Razor views to work – particularly the base class for views and the namespaces that will be used to compile the view.