Changing ASP.NET MVC 3 folder structure

Viewed 2589

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

3 Answers
Related