客户端/服务器应用 [英] Client/Server Application

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

问题描述

嗨!我需要编写客户端/服务器应用程序,并且我想使用LINQ实体通过WCF将其发送到客户端.但是,当客户端修改某些数据并将其发送回服务器时.我不能使用内置的LINQ to SQL并发访问控制.如何实现并发访问控制?

Hi! I need to write Client/Server Application and I want to use LINQ Entities to send them over WCF to client. But when client would modify some data and send them back to the Server. I cant use built in LINQ to SQL concurrent access control. How I can realize concurrent access control?

推荐答案



1)要通过网络发送实体,您需要使用DataContract属性装饰实体,并使用DataMember属性装饰字段.
2)对于并发,请按照以下步骤操作
1)从后端到客户端获取数据时,获取最后修改的字段.
2)在客户端,用最新值填充实体
3)与所有其他字段一起发送最后修改的字段
4)在您的更新语句(LINQ)中包含最后修改的where子句
5)检查有多少行受到影响
6)如果大于等于1,则表示成功(没有并发问题)
7)如果为零,则存在一些并发问题

希望对您有所帮助!.

问候,
-Vinayak
Hi,

1) To send the entities over the net, you need to decorate the entities by using DataContract attribute and the fields by DataMember attribute.
2) For concurrency, follow these steps
1) when you are getting the data from the back end to the client side, get the last modified field.
2) From the client side, fill the entity with the latest value
3) Along with all the other fields, send the last modified field
4) In your update statements(LINQ) include the where clause for this last modified
5) Check how many rows got affected
6) If it is more than one, then success (No cocurrency issues)
7) If it is zero, then some concurrency issues

I hope this helps!.

Regards,
-Vinayak


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

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