Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to convert a WinForm to a WebForm in .NET?

I didn't think it was possible but I was just talking to a co-worker who said she had done it before. Is she pulling my chain?

like image 908
Abe Miessler Avatar asked Dec 07 '10 16:12

Abe Miessler


1 Answers

Yes, it is possible. If you have designed the application well enough it should be relatively easy to convert a Win Forms application to a web forms application by just swapping out the UI layer and replacing it. You are re-using the logic and data layers (which is where all the functionality would be).

Obviously, you have to write a new UI layer from scratch, but, if the logic layer is written well enough that isn't going to be too much work compared with writing the whole application again from scratch.

However, there are some gotchas even if you have a very well written application. The logic layer may assume a stateful application in which case it may rely on lazy loading. In a web application you have a stateless model which is run on requests and responses. In that scenario you'd know exactly what you need up front and can load just the bits you need and not other things that may be needed later on... because later on will be a different request/response cycle and all the data you collect now is going to be dropped as soon as the current response is completed.

I've recently been putting the logic of an application that was originally a WinForms into MVC and the biggest barrier to getting a responsive speed is the fact that, although reasonably well written, the logic layer assumed a stateful environment. The same application is being also re-written for WPF (another stateful environment) without so many issues.

like image 143
Colin Mackay Avatar answered Sep 27 '22 22:09

Colin Mackay