有关客户端服务器应用程序的帮助. [英] Help regarding Client Server Application.

查看:87
本文介绍了有关客户端服务器应用程序的帮助.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我打算用C#编写应用程序,但在几件事上感到困惑.
应用程序是客户端服务器,我将在服务器上使用WCF.问题是


1).您是否认为在服务器端拥有所有记录会导致应用程序运行缓慢?我的意思是每次我保存一条记录或从服务器获取一条较大的记录以进行报告时,都会使应用程序运行缓慢?什么是替代品或解决方案?

2).如果客户端断开与互联网的连接几个小时该怎么办,我如何以离线模式存储记录.如果在脱机模式下将本地DB用作临时记录,那么如何同步?

Am going to make a application in C#, but am confused in few things.
Application is client server, i ll use WCF on server. problem is


1). dont u think having All record on server side ll make application very slow? i mean every time i save a record or get a large record from server for reporting ll make application very slow? what is alternate or solution for it?

2). What if Client got disconnected from internet for few hours how can i store records in offline mode. if i make local DB for temporary Records in-case of offline mode then how ll i synchronized?

推荐答案

答案1: Web服务/WCF服务一旦启动,它们的响应速度非常快,您可以异步使用它们,这样,如果发送/接收大量数据,则可以实现进度条/指示符.接下来是实现效率.机器之间只能传输所需的数据量.例如
    a: 如果您的业务层使用中间结果,然后将其保存回数据库,请将该逻辑保留在服务器端,以便仅将最终结果传回客户端.
    b:  在客户端进行可能的数据验证.
    c: 如果您必须在循环等中多次执行网络方法,请创建另一个包含该循环的方法,并以正常的本地方法执行该网络方法.
    d: 为响应式用户界面实施Web方法的异步调用.


答案2:上面提到的答案非常正确.例如如果您已在本地数据库中添加了一条记录,并且下一个可能的主键已分配给该记录.现在,假设另一个客户端在本地或全局数据库中添加了另一个记录以捕获相同的主键,因为系统不知道您已在本地数据库中捕获了该键,那么在将记录与全局数据库同步时会发生什么,并且如果您是第一个成功同步并成功完成操作的客户,那么其他客户端将在其本地数据库中使用相同的主ID做什么呢?这些问题是可以解决的,但需要付出很多努力.人们仍然依赖于Web应用程序,即使那里存在死网,用户也应以同样的方式解决此问题并要求用户接受这一真正的限制.
Ans 1: Web-services/WCF services are very responsive once they are initiated, you can use them Asynchronously so that if larger amount of data is sent/received, a progress bar/indicator can be implemented. Next thing is implementation efficiency. Only required amount of data should be traveling between machines. e.g,
      a:   If your business layer uses intermediate results and then saves them back to DB, keep that logic on server side so that only final result should travel back to client.
      b:   Do your possible data validations on client side.
      c:   If you have to execute a web-method multiple times in a loop etc, create another method that contains that loop and executes that web-method as normal local method.
      d:   Implement Asynchronous calls of web-methods for responsive UI.


Ans 2: Above mentioned answer is very true. e.g. If you have added a record in local database and next possible primary key is assigned to it. Now suppose another client has added another record in local or global database capturing the same primary key because system doesn''t know that you have captured that key at your local DB, what will happen when you will synchronize your records will global database, and if you are the first one to sync and done successfully, what other client will do having same primary ID in his local DB? These kind of problems are solvable but require alot of effort. People still rely on web applications even the exception of dead network is there, in the same way the user should tackle this problem and ask user to accept this genuine limitation.


1)这取决于您正在做什么,但通常没有.无论如何,最好从服务器中获取尽可能少的记录.

2)半连接的应用程序需要大量的思考和计划.阅读以下内容(位于vb.net中)将为您提供帮助:拔掉Northwind [ ^ ]
1) It depends on what you are doing, but generally no. It is best to fetch as few records as possible from the server in any case.

2) Semi connected applications require a lot of thought and planning. Read the following (it is in vb.net) it will help you out : Northwind unplugged[^]


这篇关于有关客户端服务器应用程序的帮助.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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