ServiceStack:DTO 中没有 IReturn 的 JsonServiceClient 使用 [英] ServiceStack: JsonServiceClient usage without IReturn in DTO

查看:35
本文介绍了ServiceStack:DTO 中没有 IReturn 的 JsonServiceClient 使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想做的是:

var client = new JsonServiceClient(ServiceUrl);
var request = new FooQuery {Id = 1};
IEnumerable<Project> response = client.Get(request);

但是,我的 FooQuery 没有实现任何 IReturn,我不希望它实现(它在没有 ServiceStack 引用的库中).这是我的服务方面:

However, my FooQuery doesn't implement any IReturn, and I'd like it not to (it's in a library without ServiceStack references). Here's my service side:

业务对象库:

public class ProjectQuery
{
    public int Id { get; set; }
}

应用主机:

Routes.Add<ProjectQuery>("/project", "GET");

服务:

public object Get(Foo request)
{
     // do stuff.
}

是否有一些不错的、干净的方法来创建 JsonServiceClient 而不在我的业务对象上使用 IReturn 接口?

Is there some nice, clean way to create the JsonServiceClient without using the IReturn interface on my business object?

推荐答案

使用 JsonServiceClient 类型中的 Send() 方法是实现此目的的方法.

Using the Send() method from the JsonServiceClient type is the way to go about doing this.

这篇关于ServiceStack:DTO 中没有 IReturn 的 JsonServiceClient 使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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