共享跨多个应用程序在同一codeBase类 [英] Sharing the same codebase across multiple apps

查看:127
本文介绍了共享跨多个应用程序在同一codeBase类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

哪些选项通常是重复使用在不同的应用程序在同一codeBase类(.e.g Web应用程序,的WinForms,等等)。

What are the options usually for re-using the same codebase across different apps (.e.g web application, winforms, etc).

我的眼前,高层次的思想是使用Web服务公开的业务逻辑的专用DLL。还有什么其他的选择有哪些?

My immediate, high-level thought is to use web services to expose a dedicated dll of the business logic. What other options are there?

感谢

推荐答案

通常情况下,你应该为你的业务逻辑和数据访问一个单独的层另一回事。这是从很高的水平视图。取决于应用程序的复杂性,业务层可以分成几个部件,其中有可能暴露于门面接口和其他组件可能具有唯一的决策逻辑可驻留在另一个组件的Web服务。这些都只是模糊的想法。

Normally, you should have a separate layer for your business logic and another for your data access. It's from the very high level view. Depending on the complexity of your application, your business layer may divided into several components where there may be web services exposed to a Facade interface and other components that might have sole decision making logic may reside in another component. These are just vague ideas.

从您的POV,你的意图之一应该是减少重复code其中有具有相同的功能的几个应用程序。即使你有一个独立的业务层,这是否解决了问题吗?也许你会从不同的应用程序调用相同的业务功能,但仍然会有很多codeS中,你必须单独管理UI层。

From your POV, one of your intention should be reduce duplicate code where there's several app having same functionality. Even if you have a separate business layer, does that solves the problem? Probably you will be invoking the same business functions from your different apps, but still there will be many codes in the UI layer where you have to manage separately.

架构设计软件来这里,来提供一个框架,将尽量减少建设不同平台的努力。

Architecting your software comes here, to provide a framework that will minimize the effort of building for different platform.

考虑您为您的应用程序相同的用户界面,这在我脑海中你的UI到底有一件事是有一个共同的控制器视图模型这将是来自网络访问,并通过赢得app,其中控制器将讨论为业务层门面接口一个代理,然后该代理会暴露你的UI层,这将是紧耦合到您的控制器视图模型

Considering you have the same UI for both of your apps, one thing that comes to my mind for your UI end is have a common Controller and ViewModel which will be accessible from both web and win app, where Controller will talk to business layer facade interface through an agent, and this agent will be exposed to your UI layer, which will be tightly coupled to your Controller and ViewModel.

这可能会帮助你这个图来想象:

This may help you to visualize with this diagram:

+------------------------------------+
|                                    |
|         DATA ACCESS LAYER          |
+------------------------------------+
+------------------------------------+
|          BUSINESS LAYER            |
| +--------------------------------+ |
| |          COMPONENT A           | |
| +--------------------------------+ |
| +--------------------------------+ |
| |          COMPONENT B           | |
| +--------------------------------+ |
|+----------------------------------+|
||        WEB SERVICE FACADE        ||
|+----------------------------------+|
+------------------------------------+
+-----------------++-----------------+
|    WIN AGENT    ||    WEB AGENT    |
+-----------------++-----------------+
+------------------------------------+
|        PRESENTATION STACK          |
+------------------------------------+
|+----------------------------------+|
||       GENERIC CONTROLLER         ||
|+----------------------------------+|
+------------------------------------+
+-----------------++-----------------+
|     WIN APP     ||    WEB APP      |
+-----------------++-----------------+

希望这有助于。

这篇关于共享跨多个应用程序在同一codeBase类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆