ASP.NET MVC2 Model/View/Controller Code
can the code that supports the model, view and controller be located in a separate proje开发者_Python百科ct? Thanks in advance.
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.
精彩评论