如何创建可以在不同计算机上运行的前端系统和后端系统 [英] How to create a front-end system and a back-end system that can run on different computer

查看:192
本文介绍了如何创建可以在不同计算机上运行的前端系统和后端系统的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好



我正在使用C#进行桌面应用程序项目,我有一个前端系统和一个后端系统。

前端系统收集客户的请求并将其存储在数据库中。

后端系统使用相同的数据库并处理请求。

前端和后端系统必须在两台不同的计算机上运行。

我还想要第三个屏幕,它通过从数据库中检索来显示更新,信息等。那就是没有与用户互动,仅用于展示目的。

基本上所有这些都应该相互沟通。



我的问题我该怎么办?

我设计了前端系统并连接到sql server 2008数据库。

我怀疑是

我是否必须为不同的任务创建不同的项目并将它们连接到同一个数据库。

如果否,那我该怎么办?

我是否必须设置系统在网络中?

请帮忙。

Hi Everyone

I am working on a desktop application project in C# where I have a front-end system and a back-end system.
The front-end system collects requests from customers and stores it in the database.
The back-end system uses the same database and processes the request..
The front-end and the back-end system must work on two different computers.
Also I want a third screen which displays updates, information etc by retrieving it from the database. That is there is no interaction with user, solely used for display purpose.
Basically all these should communicate with each other.

My question is how do I proceed?
I have designed the front-end system and connected to the sql server 2008 database.
My doubt is
Do I have to create different projects for the different tasks and connect them to the same database.
If no then how do I proceed?
Do I have to set the system in a network?
Please help.

推荐答案

你不需要专家来回答你的问题,你需要像Captain Obvious这样的人。



我会试试......



是的,你必须创建不同的项目,但要把它们放进去开发和构建的单一解决方案。只有两个不同的项目可以产生不同的组件,对吗?尽管可以成像同一个精确组件的副本可以在不同的机器上扮演不同的角色(根据,比如不同的配置文件修改行为),但这个方案看起来很人为。前端和后端的行为本质上是不同的。更重要的是,这两种不同的应用程序很可能采用不同的应用程序类型。前端应该是Windows应用程序不是很明显吗? (好吧,问题中没有任何内容听起来像Web应用程序。)至于后端,最适合的形式是Windows服务应用程序。现在,我曾经开发过应用程序,它可以同时运行Windows Service和Windows应用程序,具体取决于您如何托管它们,但这是一个非常棘手的解决方案。我有这个和高级解决方案的非常特殊的理由,并且不建议你去那么远,除非你也有非常特殊的原因。在你的情况下,我没有看到它们。所以,我们最终会得到单独的项目和单独的程序集。



现在,它可以只是两个项目和两个程序集吗?真的,真的。即使技术上可行,但听起来也不合理。为什么?如果你有两个应用程序一起工作,它们总是有很多共同的代码。至少有一些数据类型声明,但在实践中,还有很多。因此,我们将要有两个应用程序集引用的更多程序集,有些必须由两者共享。



顺便提一下,一个有用的建议:如果必须准备这些较低层的程序集集以供上层中的某些程序集共享,请隔离UI和非UI类库。关于代码,方面和松散绑定的隔离还有很多考虑因素,但是从UI中隔离是实践中最重要的事情之一。也许你需要学习所有架构模式,如MVC,MVP,MVA和MVVM ......



你应该将它们连接到同一个数据库?嗯......好吧,怎么回事?将它们连接到不同的不相关数据库?没有数据库?重点是什么?我希望我不需要继续这一部分。



现在,在网络中设置?那么,这取决于您的需求和要求。从理论上讲,您可以通过客户端 - 服务器系统间接进行交互,而不是其他任何内容。够了吗?我不知道。您没有解释您的应用程序应该做什么。我只会注意到纯客户端 - 服务器模型非常差并且通常是不够的。例如,您只需要使用轮询,拉技术和没有推送技术,这将非常差并且可能是浪费。要了解这些问题,请参阅:

http://en.wikipedia.org/wiki/Pull_technology [ ^ ],

http://en.wikipedia.org/wiki/Push_technology [ ^ ]。



-SA
You don't need an expert to answer your questions, you need someone like Captain Obvious.

I'll try…

Yes, you have to create different projects, but put them in a single solution for development and build. Only two different projects can yield different assemblies, right? Even though it's possible to imaging that the copy of the same exact assembly could play the different roles on different machine (modifying the behavior based on, say, different configuration files), this scheme would look quite artificial. The behavior of front-end and back-end is essentially different. More importantly, its very likely that those two different applications should take a form of different application type. Isn't it obvious that front-end should be a Windows application? (Well, nothing in the question sounds like a Web application.) As to the back-end, the most adequate form of it would be the Windows Service application. Now, I used to develop application which can behave as both Windows Service and a Windows application depending on how you host them, but this is a pretty tricky solution. I had very special reasons for such and advanced solution and would not advise you do go that far unless you also have very special reasons. In your case, I don't see them. So, we are ending up with separate projects and separate assemblies.

Now, can it be just two projects and two assemblies? Hardly, really. Even though it is technically possible, it would not sound reasonable. Why? If you have two applications working together, they always have a lot of code in common. At least some data type declarations, but in practice, a lot more. Hence, we are coming to having some more assemblies referenced by both application assemblies, and some have to be shared by the two.

By the way, one useful advise: if you have to prepare such lower-layer set of assemblies to be shared by some assemblies in upper layer(s), isolate UI and non-UI class libraries. There are a lot more considerations about isolation of code, aspects and loose binding, but isolation out of UI is one of the most important things in practice. And perhaps you need to learn all those architectural patterns like MVC, MVP, MVA and MVVM…

Should you "connect them to the same database"? Hm… Well, but how else? Connecting them to different unrelated databases? To no database? What would be the point? I hope I don't need to continue on this part.

Now, setup in a network? Well, it depends on what you need and what the requirements are. Theoretically speaking, you can indirectly interact through the client-server system and nothing else. Is it enough? I don't know. You did not explain what exactly your application should do. I only would note that the pure client-server model is extremely poor and often is not enough. For example, you would only need to use polling, pull technology and no push technology, which would be extremely poor and might be wasteful. To understand the issues, please see:
http://en.wikipedia.org/wiki/Pull_technology[^],
http://en.wikipedia.org/wiki/Push_technology[^].

—SA


首先,请阅读谢尔盖的回答和他的评论。



我建议做的是创建一个应用程序(一个项目),最后它应该包含2-3个窗口(登录表单,客户端/东西人屏幕/表单,详细信息表单输入/显示有关请求的信息)。客户和东西必须登录到应用程序(您可能应该存储有关请求的信息以及谁 - 哪个东西 - 将此信息输入系统。根据谁已登录到应用程序,显示第二个表单(客户/东西人形式) )并启用/禁用或显示/隐藏一些选项/菜单。客户应该只看到自己的请求,东西应该看到所有客户的请求。



这只是一个提案,但我相信它符合你的需求。





First of all, please, read Sergey's answer and His comments.

What i suggest to do is to create one application (one project), where finally it should contains 2-3 windows (login form, client/stuff person screen/form, details form to enter/display information about request). Client and Stuff person must log-in into application (you probably should store information about request and who - which Stuff person - enter this information into system. Depending on who has logged-in into application, display second form (client/stuff person form) and enable/disable or display/hide some options/menu. Client should see only own requests, Stuff person should see all client's requests.

It's just a proposal, but i believe it meets your needs.


JPais问:

我是否必须在网络中设置系统?

Do I have to set the system in a network?





用几句话就无法回答它。请按照以下链接:

ADO.NET [ ^ ]

< a href =http://msdn.microsoft.com/en-us/library/kb 9s9ks0.aspx> SQL Server和ADO.NET [ ^ ]

在ADO中检索和修改数据。 NET [ ^ ]

DataSet,DataTables和DataViews [ ^ ]

ADO.NET代码示例 [ ^ ]



请阅读相关文章。

[/ EDIT]



There is not possible to answer it in few words. Please, follow below links:
ADO.NET[^]
SQL Server and ADO.NET[^]
Retrieving and Modifying Data in ADO.NET[^]
DataSets, DataTables, and DataViews[^]
ADO.NET Code Examples[^]

Please, read related articles too.
[/EDIT]


您的前端后端系统可能在任何地方。



什么你需要做的是,使用适当的 ConnectionString 连接前端后端。 />


更多关于 ConnectionStrings - www.connectionstrings.com [ ^ ] [ ^ ]



由于 Maciej Los ADO.NET 上给你一些链接,所以你需要使用它技术,以便在前端后端之间进行通信。
Your Front-end and Back-end system may be anywhere.

What you need to do is, connecting the Front-end with the Back-end by using appropriate ConnectionString.

More on ConnectionStrings - www.connectionstrings.com[^][^]

As Maciej Los gave you some links on ADO.NET, so you need to use that technology in order to communicate between the Front-end and Back-end.


这篇关于如何创建可以在不同计算机上运行的前端系统和后端系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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