Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the better way to use WPF,WCF,PRISM

I'm developing an EMR Application as my project. there Im using WCF to transfer all the data from the centralized server , WPF for the UI and PRISM to build modules.

I have 3 projects in my solution for WPF/PRISM application

  1. The Main project(mainApplication) where the shell and bootsrapper are.
  2. Class library(modulesLib) to hold all the modules
  3. Class library(infrastructure) to communicate with wcf service ( service reference added with scvutil.exe in visual studio 2008)

project references are added as below

  • mainApplication have references of 'modulesLib' and 'infrastructure'
  • modulesLib have refence to 'infrastructure'

my current procedure is below

  1. There are 6 wcf services (6 hosts) exposed using a windows service
  2. hard coded database details inside wcf service implementations (queries, fields, tables)
  3. calling the WCF services directly withing viewmodels/ presenters for modules (through infrastructure library).
  4. Created classes called abstract ViewModelBase (which implements INotifyPropertyChanged , also having IUnityContainer,IRegionManager,IEventAggregator references) , abstract ModuleBase (which implements IModule) and I use these 2 classes to inherit from whenever I add a viewmodel or a module
  5. I put all the databinding properties in to viewmodel and use the viewmodel's constructor to instantiate a given view, set its data context and add it to a region in the shell
  6. List item

whenever I want to communicate between modules, I use CompositePresentationEvents

what I would like to know

  1. whether the way i have done things, is it seems OK for you guys .
  2. Still there are loads of errors, crashing bugs etc.. can I have a single place to handle these exceptions so the application wont break (logging or something like that)
  3. what would be your way to working on a project using WPF,WCF,MSSQL and PRISM

thank you, Nadun

like image 530
Nadun Avatar asked Dec 12 '25 00:12

Nadun


1 Answers

Most of the things you have done is fine.

But for logging module : Create a seprate project in your Infrastructure and register this as a singleton object with Unity.

2- For better unit testing of your project , use unity at it's full as a dependency creator of your classe like depend on the contract rather than actual implementation.

3- For Communication between your modules use EventAgreegator

4- For Global commands use CompositeCommand.

5- If your UI is having selector controls like Combobox, ListBox, try to extend Attached property as done in Composite Application for Button base , so that , you don't hook selection changed event in your code behind rather you will be able to call commands.

like image 176
TalentTuner Avatar answered Dec 13 '25 13:12

TalentTuner



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!