简体   繁体   English

企业应用程序中的表示层体系结构

[英]Presentation layer architecture in an enterprise application

At our company we are developing an application that will consists of several modules. 在我们公司,我们正在开发一个包含几个模块的应用程序。 The architecture is pretty much defined but I have seconds thoughts about the presentationlayer and I would really like to hear your opinions. 该体系结构已经定义好,但是我对表示层有几秒钟的想法,我真的很想听听您的意见。 The architecture is as follows: 架构如下:

Foreach module we create several namespaces and those will be compiled in their own class library. 我们在Foreach模块中创建了几个名称空间,这些名称空间将在其自己的类库中进行编译。 So for our CRM module we create the following: 因此,对于我们的CRM模块,我们创建以下内容:

  • ProductName.CRM.ServiceLayer (holds the servicecontracts interfaces of CRM module) ProductName.CRM.ServiceLayer(保存CRM模块的servicecontracts接口)
  • ProductName.CRM.ServiceLayer.Implementation (implements the servicelayer interfaces of CRM module) ProductName.CRM.ServiceLayer.Implementation(实现CRM模块的servicelayer接口)
  • ProductName.CRM.BusinessLayer (holds the businesscomponents of CRM module) ProductName.CRM.BusinessLayer(保存CRM模块的业务组件)
  • ProductName.CRM.BusinessLayer.BusinessObjects (holds the businessObjects of CRM module) ProductName.CRM.BusinessLayer.BusinessObjects(保存CRM模块的businessObjects)
  • ProductName.CRM.DataLayer (holds the DAO interfaces of CRM module) ProductName.CRM.DataLayer(保存CRM模块的DAO接口)
  • ProductName.CRM.DataLayer.SqlServer (implements the datalayer interfaces of CRM module) ProductName.CRM.DataLayer.SqlServer(实现CRM模块的数据层接口)

We create the same structure of class libraries for the modules Finance, HRM, Supply, etc: 我们为财务,HRM,供应等模块创建相同的类库结构:

  • ProductName.Finance.... 产品名称。财务...
  • ProductName.HRM.... 产品名称.HRM ....
  • etc. I think you will get the idea for now :) 等等。我想您现在会明白的:)

Also we thought about the "Crosscutting Concerns" and for that we create the following namespaces and class libraries 我们还考虑了“交叉问题”,为此,我们创建了以下名称空间和类库

  • ProductName.Framework.ExceptionHandling ProductName.Framework.ExceptionHandling
  • ProductName.Framework.Logging 产品名称。框架。记录
  • ProductName.Framework.Security 产品名称。框架。安全
  • etcetra... 等等...

So that is how our architecture is so far and at this moment I'm trying to find a proper way for setting up the PresentationLayer. 到目前为止,这就是我们的体系结构,现在,我正在尝试寻找一种设置PresentationLayer的正确方法。 For example, should I make a PresentationLayer-library foreach module (ProductName.CRM.PresentationLayer, ProductName.Finance.PresentationLayer, etc.). 例如,我应该为每个模块创建一个PresentationLayer库(ProductName.CRM.PresentationLayer,ProductName.Finance.PresentationLayer等)。 And make an overall ProductName.PresentationLayer-library who has references to all the other Module.PresentationLayer-libraries. 并创建一个整体ProductName.PresentationLayer-library,该引用具有对所有其他Module.PresentationLayer-libraries的引用。 This overall ProductName.PresentationLayer will then have the Login/MainForm functionality and the ability to start forms that are implemented in one of the modules PresentationLayer. 然后,此整体ProductName.PresentationLayer将具有Login / MainForm功能,并具有启动在PresentationLayer模块之一中实现的表单的功能。 It will be like an entry point of the application to other modules. 就像应用程序进入其他模块的入口一样。

Or... 要么...

Should I make just one ProductName.Presentation-library that contains all forms for all modules. 我应该只制作一个ProductName.Presentation-library,其中包含所有模块的所有表单。 By doing that that I can easly navigate to other forms and don't have to worry about references between modules when they are going to use each others forms (sometimes they will do). 这样,我可以轻松导航到其他表单,而不必担心模块之间要使用其他表单时的引用(有时它们会这样做)。

The first solutions sounds good to me. 第一个解决方案对我来说听起来不错。 However, when forms from different modules wants to navigate to each other.This kind of functionality will be tough to implement because only one of the two can have the reference to the other. 但是,当来自不同模块的表单想要相互导航时,将很难实现这种功能,因为这两个功能中只有一个可以引用另一个功能。

I would really like to hear your opinions about this issue I'm dealing with and maybe someone could give me a proper solution or idea that I can use. 我真的很想听听您对我正在处理的问题的意见,也许有人可以给我适当的解决方案或想法,让我可以使用。

thanks in advance, Cheers! 在此先感谢,干杯!

You can always create interfaces that forms implement if they need to exchange data. 如果表单需要交换数据,则始终可以创建表单实现的接口。 In fact, it's probably not a great idea to have lots of forms knowing about each other as that creates maintenance and enhancement problems in the long run. 实际上,拥有很多相互了解的表格可能不是一个好主意,因为从长远来看,这会造成维护和增强问题。

By using interfaces and potentially some kind of Locator service, you can avoid hardwiring dependencies between forms - and then you are free to use either architectural model (1 big assembly vs. many smaller ones). 通过使用接口和可能的某种Locator服务,您可以避免在表单之间进行严格的依赖关系-然后您可以自由使用任何一种架构模型(1个大型程序集与许多较小的程序集)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM