0

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

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

1 Comment

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.