开发者

Duplex + Silverlight + WCF + Pulling data

I've been looking for it, for quite and while, and I didn't really find anything that cover how to pull data trough duplex connection for Silverlight (pollingHttpDuplex).

I have setup basic sub/pub application with duplex.

Now I wanted to get list of topics, that are users are connected to. My first thought, was to setup simple DataContract (with only one field TopicName), then get data from Dicionary that I've been using to store current topics. So I end up with something like this:

[OperationContract]        
public List<Topic> GetTopicList()
{
    List<Topic> topicList;

   开发者_Go百科 topicList = (from p in _sessionIDTopic
                select new Topic
                {
                    TopicName = p.Value
                }).ToList<Topic>();

    return topicList;
}

[DataContract]
public class Topic
{
    [DataMember]
    public string TopicName { get; set; }
}

I'm doing something wrong here. Because big question is how to send this to the client (Silverlight 4), and bind it to controls ?

Also duplex is essential for application. Changing it for anything else is not an option.


Using a duplex connection here doesn't have any effect on how you get the data to the client. The example you specified looks like simple one way communication. To do that, your client project needs a service reference to the server, and the generated proxy will provide the methods the client needs to access the operations on the server.

I think you should start by looking at a simple WCF example project to see what I mean. If this is not your problem, please rephrase the question.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜