Click here to Skip to main content
15,893,508 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a winform application consists of forms and cs files. SQL server DB connected to the code via dataset table adapters. I need to convert this winform application to a webApi.
Posted
Comments
Kornfeld Eliyahu Peter 17-Dec-14 17:27pm    
If you are looking for an automated way - there is none!
You have to rewrite your application in the new environment with the new tools...
proudwarrior 17-Dec-14 18:32pm    
Thanks for the reply, yes I need to write the code in MVC pattern. I have never done this before.

1 solution

There is no "convert", not because this is difficult or impossible, but because there is no such notion, it means something undefined. This is because these are different application types, different in their nature, without one-to-one correspondence. In practice, it means that you have to define what exactly your new application should do; it cannot do anything exactly as your original application does.

If you are going to write a new MVC application, do it, and, if you face problems, ask more specific questions, than we will gladly try to help you.

—SA
 
Share this answer
 
Comments
proudwarrior 17-Dec-14 18:31pm    
Thanks for replying, I think I have to write a new code in MVC pattern using those forms as views and need to figure out what will go in the controller and the model.
Philippe Mori 17-Dec-14 23:08pm    
You cannot uses WinForms as views in an ASP.NET MVC application. Forms and views are totally unrelated. Other than taking some ideas from the original forms like controls that were used, there are not much you can do.

If you really have a lot of forms, then you might be able to write a small application that would generate part of the code from controls that are on the form to save some typing.

On the other hand, maybe you don't event want to keep a relashionship between the number of form in original application and the number of web page in the new application.
Sergey Alexandrovich Kryukov 18-Dec-14 10:55am    
Exactly.
—SA
proudwarrior 18-Dec-14 13:29pm    
Thanks, but I am really new to this WebApi world and I am not sure how I can write a application that will " write a small application that would generate part of the code from controls that are on the form ". Is there any sample code or documentation you know, that would be a great start for me.
Philippe Mori 18-Dec-14 13:52pm    
Are you doing an ASP.NET application using razor pages? Or you want to create an application that uses services to get the data...

Before porting an application, you have to learn how to write at least a simple application that would do enough so that you are confident that you can do it and have an idea on how it works.

It is relatively easy to learn stuff as their are a lot of tutorials and videos on the web. I would recommand to listen a few video first to have an idea on how things works and then follow tutorials for what you need to do. You just have to Google asp.net tutorials to get some usefull links. Once you have a basic idea, then you can refine your search to find more specific information.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900