我们可以将参数传递给服务合同吗 [英] Can We Pass a parameter to a Service Contract

查看:105
本文介绍了我们可以将参数传递给服务合同吗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我们正在开发一个多方视频会议系统.我们将使用WCF开发服务器.
我计划要做的是,为我们必须实施的每个不同的服务制定一份单独的服务合同.一个服务合同用于处理视频会议,另一个服务合同用于用户管理(登录,注销,状态等),另一个服务合同用于处理即时按摩服务.我将保留当前在线的用户列表.并且此列表应由以上所有服务使用(相同的用户列表).
如果有一种方法可以在启动每个服务时传递用户列表.我可以执行以上计划.

如果有人知道该怎么做,请回复我.如果此架构或我执行此操作的方式存在问题,请告诉我执行此操作的便捷方法. (我尚未实现此功能.因此我可以更改体系结构).

感谢Wijitha
谢谢.

Hi all

We are developing a Multiparty Video conferencing system. And we are going to use WCF for developing the server.
What i have planed to do is, to have a separate  service contracts for each distinct services that we have to implement. One service Contract is for Handle Video conferences, another one for user management(Login, Logout, Presence ect), And another Service Contract for handle instant massaging service. And I'm gonna keep a list of users who are currently online. And this list Should be used by all the above services(same user List).
If There is a methodology to pass User List  when each service is started. I can implement above plan.

if any one knows how to do this please reply me. And if there is some thing wrong with this architecture or way I'm doing this please tell me convenient way to do this. (I have not implemented this yet. So i can change the architecture)

regards
Wijitha
Thank You.

推荐答案

您好,

您没有提到任何可伸缩性要求,因此,如果此系统要处理相对较少的会话/用户,则在内存中共享列表是可行的. >
有多种方法可以执行此操作,但是最简单的方法是使用一个线程安全的静态类(包括它的字段和操作)来保持不同服务之间的共享状态.当然,这些服务必须托管在同一应用程序中才能运行.

如果要扩展系统,此方法是不合适的.您将需要使用保存
共享数据的后端数据库(数据库).

HTH,

--larsw
Hi,

 You do not mention any scalability requirements, so if this system is to handle a relatively small number of sessions/users,
 it is feasible to share the list in-memory.

 There are multiple ways of doing this, but the easiest is to have a thread-safe, static class (incl. it's fields & operations) that is used
 to hold the shared state between the different services. The services must of course be hosted in the same application for this to work.

 If you want your system to scale, this method is not adequate. You will need to use a back-end datastore (database) that holds the
 shared data.

 HTH,

 --larsw


这篇关于我们可以将参数传递给服务合同吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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