1

We are developing an application that is going to have a Desktop WPF app and a web-face on ASP MVC. My main question is, what is the way to go to make the work as less repetitive as possible.

My ideal is developing the WPF app in someway using the MVC pattern, so that we could just copy/paste the controllers from the WPF app to ASP and work only on the View part. Is that possible?

I have researched and found that for that kind of tasks I could also stick on to using XBAP, but, as far as we have researched, many people are having problems with launching them. Silverlight is also not a way to go :(

Any ideas?

Thanks for your time!

2
  • You need to develop a desktop app and web app, at the same time, with the exact same features/capabilities? Why? Commented Feb 25, 2014 at 17:01
  • Is the idea that the desktop app would run entirely locally (as in no server)? Commented Feb 25, 2014 at 17:05

3 Answers 3

3

No, you can't "copy/paste" stuff from a Windows application to a Web Application. And no. "copy/paste" is not an optimal way of reuse.

You're going about this in a completely wrong way.

The main idea behind Reusability is to keep application components and layers decoupled from each other so that they can be ported to different applications or even different platforms.

There's no way you are going to share Presentation code between a Web and a Windows application (regardless of the underlying UI frameworks on each side) simply because the HTML-based Web UI is stateless in nature and a Windows application is usually developed in a stateful way.

What you need to do is to use MVVM in the WPF side (as opposed to MVC) in order to keep the application logic and most importantly the Business Logic completely decoupled from the UI.

This way there will be a much greater opportunity for reuse in any other platform. All your shared Business Logic and application logic will live in UI-agnostic layers which don't really "care" about the Front-End.

Sign up to request clarification or add additional context in comments.

1 Comment

Well, yes, when I wrote "copy pasting" I meant the part of the business logic that could be reused. I'll look into MVVM. Thank you for your help!
1

Not possible. WPF and ASP.NET MVC have totally different Views.

Only thing you could re-use is your back-end API. Instead of injecting your API classes into your ViewModels like you would with WPF, you would be injecting those same API classes into your MVC controllers.

Comments

1

I would advice to forget the idea of reusing large pieces of client code.

What I would recommend is to build a 3-tier architecture, so you could reuse all the service layers (business services and DAL) in both ASP.Net MVC and WPF applications. You'll still have to code a lot of specific code in each application.

If your main goal is to deploy a WPF application through the Internet, then XBAP is the way to go. Or Silverlight, as it's a mature technology that'll be supported for years.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.