开发者

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

开发者 https://www.devze.com 2023-01-12 10:06 出处:网络
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 UIand PRISM to build modules.

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 ( servi开发者_StackOverflow社区ce 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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消