leora
leora

Reputation: 196429

migrating website from asp.net to asp.net mvc

are there any high level best practices when doing this conversion?

Upvotes: 2

Views: 159

Answers (3)

mkchandler
mkchandler

Reputation: 4758

If you already have your Model layer (services, models, repositories, etc.) in a separate project, your web site would not be that hard to move. But it will still require some reworking for the interface... you will have to create Views, ViewModels, Controllers, ModelBinders, etc.

If your project is not currently set up using an n-tier approach, I would recommend moving towards that before you move the whole site to MVC. It will make the move to MVC all that much easier, without having to redo the entire project at once.

Upvotes: 3

Kieron
Kieron

Reputation: 27107

Does it all really need to be converted would be my number one question here? MVC and Web-Forms can live side-by-side in the same app, so could new pages/ sections simply be developed using MVC if that's the route you want?

Upvotes: 1

user151323
user151323

Reputation:

I do not believe there is a vast experience gathered on this matter.

Some people are migrating their projects, the others are staying with WebForms. Not every project can be migrated to MVC in that way that you can still speak of migration and not of complete rewriting of several layers. Not all projects need to be migrated.

If I were to start that kind of migration, the foremost thing I would do is to try to understand whether it makes sense anyway for this particular project to be migrated. MVC is very good for web sites. Web applications with very complex UI (lots of interdependent controls) will be very difficult to migrate. Since now you won't be able to rely on event-model and will have to manually code lots of JavaScript to interconnect controls (enable/disable, repopulate, show/hide etc.). Are you ready for that?

If however you decide to go on, the first thing I would try is to gather the code scattered all over your project including the code-behind classes to unify it and split into two categories: business rules and controller decisions. Many WebForms projects are really a bad mess with no separations of concerns but just one big monolithic piece of code. If you manage to split it into layers (data access, business rules, controller logic) you win. Otherwise the enterprise is doomed.

Upvotes: 6

Related Questions