MVP or MVVM framework for both WPF and .NET CF 3.5 development
I am creating a draft architecture outline for a disconnected client-server platform, that involves multiple different client types. I need to support: web clients, desktop workstations and mobile devices (WM 6开发者_C百科.x now and Android later).
I am searching for a MVP or MVVM based framework that would let me to reuse as much of the code and architecture as possible between clients, while:
- using WPF for desktop development
- using .NET CF 3.5 for Windows Mobile development
This framework does not obviously need to support Android, however I am considering Mono for Android to develop the Android client (for easier maintenance of the whole platform), so portability would have been an added asset.
So far I ruled out:
- Prism (does not support WM based mobile devices - Windows Phone 7 only)
- MVC# (does not support WPF)
I would appreciate any hints that would aid in researching the subject further.
These MVVM Frameworks work with Windows Phone 7:
- Caliburn Micro
- MVVM Light (it doesn't advertise it, but I've been to a demo where it was used on WP7)
- ReactiveUI (Uses the Reactive Extensions for .NET)
My personal favorite is ReactiveUI, but if you've never used the Reactive Extensions it can be a brain burner at first.
As for UI Composition (you mentioned Prism), there aren't a lot of options, mostly due to reflection restrictions on the phone. I have seen an article where someone got basic MEF working on the phone and MEF is probably all most people need in this situation. You can check out that article here.
Hope this helps.
In my opinion, this would be a custom Framework with a mix of UI Processes for different client types. The business logic or entities can definitely be reused to suit the needs of the view.
I did the same research and I concluded the following (which I did not implement yet):
- There aren't any open source MVVM frameworks that support .NETCF. You can only find MVC or MVP, but not MVVM.
Suggestion: get the source code of an Open Source MVVM framework that supports the Full/Desktop .NET, and see if you can adapt it(so that it recompiles) to the .NETCF. I found the following two, which also support the other platforms that you mentioned:
- MVVM FX for Windows Forms and Visual WebGUI - Home
- MugenMvvmToolkit
Other than that, I don't see any other way of doing this.
HTH,
MVVM wouldn't make much sense in Windows Mobile + .NETCF since you don't have INotifyPropertyChanged and implementing Model-View-Presenter in WPF or any INotifiyPropertyChanged supported framework wouldn't be as effective as Model-View-ViewModel
You can share assets between the full and compact framework by moving most of the business logic into a seperate class library (or several) that target the .NETCF. You can reference a .NETCF library from a full framework project, but not the other way around.
Check out this very good article by Daniel Moth describing how to share assets between the compact and full framework: http://msdn.microsoft.com/msdnmag/issues/07/07/ShareCode/default.aspx
精彩评论