您可以在分层架构中绕过某个层来执行特定操作吗?
在 n 层(比如说 5 层)应用程序中,如果某个操作可以选择绕过其中一层并直接与下一层通信,那么它仍然可以称为“n 层”架构吗? ,还是变成(n-1)层(4层)架构?
您可以绕过的有问题的层是否应该被视为“层”?
编辑:我正在尝试实现具有以下结构的应用程序 -
表示层(包含 WPF 网格)
应用层(包含应用程序逻辑和工作流作为应用程序服务,从域模型对象中提取显示模型对象,然后将其绑定到 UI 网格)
领域层(仅包含领域模型对象)
存储库(存储从数据库获取的数据,上下层隔离)
数据映射层(将领域模型对象映射到数据模型对象)
数据访问层(包含数据模型对象,并在数据库中存储和检索数据)
-上述每一项都作为单独的项目实现,领域层由应用程序层、存储库和数据映射层引用。现在的问题是,应用程序层直接与存储库通信,而不是通过域层进行通信,而域层(如果我可以称其为层)就像一个横切引用。这就是我的问题所在,我应该将其称为域“层”吗?我认为不是。但是在领域驱动设计中存在一个领域层,对吧?我的架构一定有问题吗?它在哪里、是什么?
In an n-layered (5-layer, let's say) application, if there are options available for a certain operation to bypass one of the layers and communicate with the next layer directly, can it still be called an "n-layer" architecture, or does it turn into an (n-1)-layered (4-layer) architecture?
And should the layer in question, which you can bypass, be considered as a "layer" at all?
EDIT: I'm trying to implement an application with following structure -
Presentation layer (contains WPF grids)
Application layer (contains application logic and workflow as application services, extracts display model objects from domain model objects, which are then bound to the UI grids)
Domain layer (contains domain model objects only)
Repository (stores data fetched from the database, isolates the lower layers from the upper layer)
Data mapping layer (maps domain model objects to data model objects)
Data access layer (contains data model objects, and stores and retrieves data to and from the database)
-each one above is implemented as separate project and the domain layer is referenced by the application layer, repository and data mapping layer. Now the thing is, the application layer is directly communicating with the repository, not through the domain layer and the domain layer (if I can call it a layer at all) is acting just like a cross-cutting reference. So that's where my question comes, should I call it domain "layer"? I think NOT. But in domain-driven Design there exists a domain layer, right? There must be something wrong in my architecture? Where and what is it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以拥有任意数量的层,并将其称为 n 层系统……它们是否正确使用或松散耦合是另一个问题。
您谈论绕过层的事实可能意味着您过度设计了一个解决方案,或者您以无益/不正确的方式实现了一个层......您需要提供一些使用示例才能真正在这里提供更多帮助...
You could have as many layers as you want and call it an n-layered system...whether they are used properly or loosely coupled is another question.
The fact that you talk about bypassing a layer may mean you've over engineered a solution or you have implemented a layer in an unhelpful/incorrect way...You'd need to be providing some samples of usage to really help out more here...