views:

56

answers:

1

hi,

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

+1  A: 

Hi Nadun

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.

saurabh
hi saurabh, several points in your post caught my attention :). the attached property extension (I currently handle selected item changed by binding a property on viewModel to selectedItem of the list/combo box, and then in the INotifyPropertyChanged Implementation I have put a switch to execute another method) and the logging approach. I'll have some research on those. if you don't mind I'll leave the question unanswered so there s still room for people to share their thoughts. hope its fine for you :) Thank you for replying..
Nadun