Migrating a legacy Webforms application to asp.net mvc?
does anyone have good links or tips on best practices concerning migrating from ASP.NET Webforms to ASP.NET MVC?
We have a large webforms application that we would like to piece by piece migrate to MVC. Here is our current setup.
Two big Webforms project (VB) Multiple class libraries and services (C# and VB.Net) Subsonic 2.2 Data access layer SQL Server 2008 DB
We are considering the following:
- Keep the classic webforms project running as is for now while developing.
- Create new MVC project based on MVC 3 with Razor view engine
- Use Nhibernate (Repository pattern) DAL
- Conv开发者_如何学运维ert/build the existing functionality module by module in the MVC project
- Replace some functionality in the old webforms project with new MVC modules if possible. Integrate via eg. Iframes.
- In time the new MVC app will replace the old webforms project entirely.
We would like to keep the DB as is so we also need a tool to create the Model based on the DB.
Is this a possible solution?
WebForms applications use server-side session a lot because most of the server controls use it internally. You will not be able to use any of the server controls that you used in WebForms in MVC3 (atleast without some tinkering).
MVC3 promotes the use of restful architecture, where any state is maintained in html or url or cookies, and these are reasons why I think you should revisit the decision to convert to MVC3. Do so only if it will give you a huge advantage, because I suspect you will be reinventing ground up your existing app - I suspect there will be an equal amount of effort migrating it as to while developing it new.
Again there is nothing preventing you from creating an "area" or a "region" of MVC in your webforms app, if your goal is to use MVC for future development.
If you still want to move to MVC3, take a look here
It is ok solution. Also for NHibernate you can use MyGeneration with NH plugin to generate models on top of existing DB. And it is also possible to host WebForms and MVC together in one web app. Just finished quite the same task. But used EF for DAL.
精彩评论