I have been developing an app with ASP.NET4 + MVC3 + EF4; at this point, I'd like to reuse / integrate some existing code from an app written in 2008, using ASP.NET2 + webforms.
The "old" app file structure does not have "Models", "Controllers" and "Views" folders like the "new" MVC3 app has; however, the "old" app has a lot of high-quality code with very similar functionalties that I want to use for the "new" app.
Are there any "general guidelines" or "tricks" or advices someone can offer for this situation? What is the best way to adapt, add and reuse the code from the old app to the new app?
, I'd like to reuse / integrate some existing code from an app written in 2008, using ASP.NET2 + webforms.
The "old" app file structure does not have "Models", "Controllers" and "Views" folders like the "new" MVC3 app has; however, the "old" app has a lot of high-quality code with very similar functionalties that I want to use for the "new" app.
The WebForm is not MVC. So the programming models are very different.
claudia888
Are there any "general guidelines" or "tricks" or advices someone can offer for this situation?
Yes.
1. See all controls in WebForms - re-make them as HtmlHelpers or displaytemplates/editortemplates
2. Extract all business logic from webforms in a dll
3. Make a new MVC project , add the 2 dll as a reference and 1 code.
claudia888
Member
193 Points
484 Posts
How to integrate code from an "old" app written in ASP.NET2 into a "new" app written in ASP.NET4+...
May 11, 2012 04:16 AM|LINK
Hi,
I have been developing an app with ASP.NET4 + MVC3 + EF4; at this point, I'd like to reuse / integrate some existing code from an app written in 2008, using ASP.NET2 + webforms.
The "old" app file structure does not have "Models", "Controllers" and "Views" folders like the "new" MVC3 app has; however, the "old" app has a lot of high-quality code with very similar functionalties that I want to use for the "new" app.
Are there any "general guidelines" or "tricks" or advices someone can offer for this situation? What is the best way to adapt, add and reuse the code from the old app to the new app?
Thnak you very much in advance for your help!
Claudia
ignatandrei
All-Star
137698 Points
22155 Posts
Moderator
MVP
Re: How to integrate code from an "old" app written in ASP.NET2 into a "new" app written in ASP.N...
May 11, 2012 04:56 AM|LINK
The WebForm is not MVC. So the programming models are very different.
Yes.
1. See all controls in WebForms - re-make them as HtmlHelpers or displaytemplates/editortemplates
2. Extract all business logic from webforms in a dll
3. Make a new MVC project , add the 2 dll as a reference and 1 code.
Re-make the project from there from scratch
claudia888
Member
193 Points
484 Posts
Re: How to integrate code from an "old" app written in ASP.NET2 into a "new" app written in ASP.N...
May 12, 2012 05:16 PM|LINK
Hi Andrei,
Thanks for your suggestion. Do you mind providing some info/tutorial for me to start learning on each of the 3 steps you suggested?
1. See all controls in WebForms - re-make them as HtmlHelpers or displaytemplates/editortemplates --> Anywhere I can find some sample code?
2. Extract all business logic from webforms in a dll --> How to do that? Cna I use VS to do it? If not, another tool?
3. Make a new MVC project , add the 2 dll as a reference and 1 code. --> What are the "2 dlls"? Also by "1 code" what you are refering to?
I will check often for your reply. Thanks,
Claudia
ignatandrei
All-Star
137698 Points
22155 Posts
Moderator
MVP
Re: How to integrate code from an "old" app written in ASP.NET2 into a "new" app written in ASP.N...
May 13, 2012 06:50 AM|LINK
Nope. That depends on your controls.
Nope, That implies re-factoring. Please read
http://www.amazon.com/Refactoring-Improving-Design-Existing-Code/dp/0201485672
Sorry, my bad. The dll from the second point - the re-factoring one.
claudia888
Member
193 Points
484 Posts
Re: How to integrate code from an "old" app written in ASP.NET2 into a "new" app written in ASP.N...
May 17, 2012 01:07 PM|LINK
Thanks a lot Andrei! I will follow your suggestions and see how it goes.
I appreciate it,
Claudia