views:

17

answers:

1

Hi all, can the code that supports the model, view and controller be located in a separate project? Thanks in advance.

+1  A: 

Moving the model classes into a separate project is straightforward and works fine. You can't move the views out of the ASP.NET MVC project because, well, they're ASPX pages or ASCX controls. You could probably move the Views to another project, but you'd lose some of the Visual Studio integration features that simplify moving between Controller and View.

As a general rule, it's usually better to keep these things in a single assembly due to the overhead in .NET of loading external assemblies. I don't see any significant problems with moving the Model out, but I'd suggest keeping the Controllers in the ASP.NET MVC project.

Jim Lamb
I'd keep most of the code in another assembly as well, and simply have my Controller Actions invoke that assembly, do stuff, and return Views.
Nate Bross
Great guys, thanks for the responses.
Sean