我有兴趣更改结构文件夹.我读过很多文章,但我还没有找到解决方案.
我想这样做,以将文件和文件夹分发到专题文件夹.我已经从RazorViewEngine创建了一个基类BaseViewEngine
- public class BaseViewEngine : RazorViewEngine
- {
- public BaseViewEngine()
- {
- MasterLocationFormats = new[]
- {
- "~/Themes/My/master.cshtml"
- };
- ViewLocationFormats = new[]
- {
- "~/Modules/{1}/{0}.cshtml"
- };
- PartialViewLocationFormats = new[]
- {
- "~/Blocks/{0}.cshtml"
- };
- }
- }
但它不工作.
更新
控制是原始的只用于测试
- public class HomeController : Controller
- {
- public ActionResult Index()
- {
- var test = new Test { Text = "Hello" };
- return View(test);
- }
- }
和视图
- @model DemoModules.Test
- <h2>Index</h2>
但是当我运行项目我得到错误
CS0103: The name of the ‘model’ does
not exist in the current context