简体   繁体   English

不同的 wcf 服务用于服务器-客户端应用程序中的不同任务,服务之间共享数据

[英]Different wcf services for different tasks in server-client application, Sharing data between services

We are developing a server-client application in c# using wcf services and wpf.我们正在使用 wcf 服务和 wpf 在 c# 中开发服务器-客户端应用程序。 We were thinking about 3 different wcf services:我们正在考虑 3 种不同的 wcf 服务:

  • service for logging in and out登录和注销服务
  • service for getting data from database从数据库获取数据的服务
  • service for file transfer文件传输服务

The problem is that we want to store currently logged in users in some list.问题是我们希望将当前登录的用户存储在某个列表中。 Login service whould store a user with a given temp key and return that key to client.登录服务将使用给定的临时密钥存储用户并将该密钥返回给客户端。 When client calls data service it passes that key and data service should check in the currently logged in user list if it exists.当客户端调用数据服务时,它会传递该密钥,并且数据服务应该检查当前登录的用户列表(如果存在)。 We are stuck at how and where to keep the user list, and how would the data service be aware of it.我们被困在如何以及在哪里保存用户列表,以及数据服务如何知道它。

We are hosting all three services in wpf application.我们在 wpf 应用程序中托管所有三个服务。

We would much appreciate any suggestion or direction to the solution, Thanks我们非常感谢您对解决方案的任何建议或指导,谢谢

If the services are hosted in the same process, you can simply use some local dictionary ( Dictionary<string, UserData> ) in memory (or in a persistent storage, if necessary), and access it via a shared (static) class.如果服务托管在同一进程中,您可以简单地在 memory 中(或在持久存储中,如果需要)使用一些本地字典( Dictionary<string, UserData> ),并通过共享(静态)class 访问它。 Do you need anything more complex than that?你需要比这更复杂的东西吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM