WPF、WCF、PRISM 更好的使用方法是什么

发布于 2024-09-14 20:38:24 字数 1122 浏览 2 评论 0原文

我正在开发一个 EMR 应用程序作为我的项目。我使用 WCF 从中央服务器传输所有数据,使用 WPF 用于 UI,使用 PRISM 构建模块。

我的 WPF/PRISM 应用程序解决方案中有 3 个项目

  1. 主项目(mainApplication),其中 shell 和 bootsrapper 所在。
  2. 类库(modulesLib)保存所有模块
  3. 类库(基础设施)与wcf服务通信(在Visual Studio 2008中用scvutil.exe添加的服务引用)

项目引用添加如下

  • mainApplication具有'modulesLib'和'infrastruction'的引用
  • moduleLib 引用了“基础设施”,

我当前的程序如下

  1. 有 6 个 wcf 服务(6 个主机)使用 Windows 服务公开
  2. 硬编码数据库详细信息 在 wcf 服务实现(查询、字段、表)中
  3. 直接使用 viewmodels/presenters 调用 WCF 服务对于模块(通过基础设施库)。
  4. 创建了名为抽象 ViewModelBase 的类(它实现 INotifyPropertyChanged ,还具有 IUnityContainer、IRegionManager、IEventAggregator 引用)、抽象 ModuleBase (它实现 IModule),每当我添加视图模型或
  5. 放置所有数据绑定属性的 模块时,我都会使用这两个类进行继承进入 viewmodel 并使用 viewmodel 的构造函数来实例化给定视图,设置其数据上下文并将其添加到 shell
  6. 列表项

中的区域中,每当我想在模块之间进行通信时,我都会使用 CompositePresentationEvents

我想知道

  1. 我是否可以使用 CompositePresentationEvents已经做了一些事情,对你们来说似乎还可以。
  2. 仍然存在大量错误、崩溃错误等......我可以有一个地方来处理这些异常,这样应用程序就不会中断(日志记录或类似的东西)
  3. 使用 WPF、WCF、MSSQL 处理项目的方式是什么和棱镜

谢谢你, 纳敦

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

爱冒险 2024-09-21 20:38:24

你所做的大部分事情都很好。

但对于日志记录模块:在您的基础设施中创建一个单独的项目,并将其注册为 Unity 的单例对象。

2-为了更好地对项目进行单元测试,请充分使用 Unity 作为类的依赖项创建者,就像依赖于合同而不是实际实现一样。

3- 对于模块之间的通信,请使用 EventAgreegator

4- 对于全局命令,请使用 CompositeCommand。

5-如果您的 UI 具有 Combobox、ListBox 等选择器控件,请尝试扩展 Attached 属性,如按钮库的复合应用程序中所做的那样,这样,您就不会在后面的代码中挂钩选择更改事件,而是可以调用命令。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文