Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>First of all, it is certainly a good idea to put your model into a separate project. As you've discovered, this is trivial.</p> <p>Regarding Controllers and Views, I don't see any obvious advantage to separating them for most basic projects, although you may have a particular need to do so in a particular application.</p> <p>If you do choose to do this, then you will need to tell the framework how to find your controllers. The basic way to do this is by supplying your own ControllerFactory. You can take a look at the source code for the DefaultControllerFactory to get an idea for how this is done. Subtyping this class and overriding the GetControllerType(string controllerName) method may be enough to accomplish what you're asking.</p> <p>Once you've created your own custom ControllerFactory, you add the following line to Application_Start in global.asax to tell the framework where to find it:</p> <pre><code>ControllerBuilder.Current.SetControllerFactory(new MyControllerFactory()); </code></pre> <p><strong>Update:</strong> Read <a href="http://codeclimber.net.nz/archive/2008/11/14/how-to-call-controllers-in-external-assemblies-in-an-asp.net.aspx" rel="noreferrer" title="How to call controllers in external assemblies in an ASP.NET MVC application">this post</a> <em>and</em> the posts it links to for more info. See also Phil Haack's comment on that post about:</p> <pre><code>ControllerBuilder.Current.DefaultNamespaces.Add( "ExternalAssembly.Controllers"); </code></pre> <p>...which is not a complete solution, but possibly good enough for simple cases.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload