Click here to Skip to main content
15,879,326 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have a project on the horizon which needs to be integrated to both our windows based and web hosted products.

I was thinking the best approach for this, to limit the duplication of work would be to use MVC so only the View aspect would require duplication.

So my question is, are there any MVC frameworks out there for .Net which work well for both web based and form based development?

Or can you provide a better approach than MVC for minimising the duplication of work?

With other solutions keep in mind that I do not have access to IIS for web hosting with our windows based products, I can't use ClickOnce as Mac/Linux/Tablet support is required for the web version and we have no developer resources other than .Net resources.
Posted

1 solution

You have several possibilities to make your UI: WindowsForms, WPF, Silverlight, classic ASP.NET and MVC if you like to have control over html code. As both WPF and Silverlight have XAML engine (see MSDN[^]), you can target this approach.
But the major issue is the separation of logic: with every web based approach you have to deal with a server and a client side. Thus, you have to deal with statelessness and with communication issues, bandwidth problems and so on. With a desktop application you will have probably all the logic installed on the client. Or at least the temptation will be there to move more logic on client side.
If I understand correctly, your windows based application will be only a presentation layer. But Why bothering with it?
You take a really good path with MVC! If you don't need a extreme GUI, HTML5 gives you the possibility to make application look like a charm, with JQuery it will work in the browser like a charm, and now, with Web API[^] you can even host the server side logic outside IIS.
So, take the metro approach: everything runs in a browser. Make your GUI in HTML5, CSS3 and JQuery, make your logic in ASP.NET MVC4 or whatever you like, but do not generate html code on server side. Serve only static content and BL from the server. Create small windows forms app, that contains a WebBrowser control (or other browser control), and add as less code to it as possible - only to connect to the preconfigured server, and basic i/o.
Thus the customer will be able to use it's browser or this little app: same experience, no duplicated work, and no client side OS dependency (but you will need a good browser - or you have to serve different UI based on the client browser detected)

But let's clarify: Microsoft MVC is ASP.NET based, you need an ASP.NET enabled host to run it. You can make the server side logic on any other platform, and interact with it via JSON or XML, or whatever from a web browser based or a forms client. But that will be no Microsoft ASP.NET MVC anymore.
 
Share this answer
 
Comments
Wonde Tadesse 5-Jul-12 21:38pm    
5+
Stephen Hewison 6-Jul-12 4:17am    
Thanks for the response. I wasn't specifically asking about Microsoft's ASP.Net MVC, MVC is a programming pattern which can be applied to any application with an interface. Furthermore and unfortunately, I can't take the approach you advise as the application uses a component of which there is both a windows and ASP.Net version. The web version must render from a server which I don't have access to where the windows version will be installed. XAML is not an option, because as I stated in the question, I require tablet support, including iPads.
Zoltán Zörgő 6-Jul-12 5:38am    
As I see, you want a platform-dependent application to work as platform-independent, but without changing anything. I don't got your point: how do you want to build something from ground up different, if you cannot/don't want to change essential part of it?
Sorry, but your constraints give an empty result set :(. You have to give up on something.
Stephen Hewison 6-Jul-12 7:44am    
I was half expecting an "empty result set" to the question. But I thought I'd try and draw on other's experience nonetheless. Only the website needs to be platform independent. So the UI must be HTML. The windows application will obviously be windows. I'm just trying to minimise the duplication of work required to deliver both. I appreciate the "constraints" are constraining but sadly that's the world we live in. But thanks anyway for your time. +5
Zoltán Zörgő 6-Jul-12 13:35pm    
Thank you.
That is why I suggested to forget the classic windows UI. We are heading towards a unified platform for all devices. And the latest web standards have the tools to do it. You can make really rich UI and strong BL with just a browser. Just a snippet: http://slides.html5rocks.com/

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