鉴于请求“foo?Bar = baz”,我们的RequestResource过去在资源的“Bar”属性中填充了值“baz”。
知道为什么会破坏这个? ServiceStack最近发生的任何重大变化?我们已经从3.9.17.0升级到3.9.32(同样失败了.33)。 干杯
代码:
[DataContract(Name = "Response")]
public class ItemsServiceResource
{
public ItemsServiceResource()
{
PageInfo = new PageInfo
{
PageNumber = 1,
PageSize = 100
};
}
[DataMember]
public int UserId { get; set; }
[DataMember]
public PageInfo PageInfo { get; set; }
[DataMember]
[JsonProperty]
public List<Model.Item> Items { get; set; }
// this is the property that comes now as null instead of being populated
public string SearchTerm { get; set; }
}
public class ItemsService : RestServiceBase<ItemsServiceResource>
{
public override object OnGet(ItemsServiceResource request)
{
//do work
}
}
端点注册是:
public class AppHost
{
public AppHost()
: base("blah Host") {}
public override void Configure(Funq.Container container)
{
Routes
.Add<ItemsServiceResource>("/user/{userId}/items/")
}
}
答案 0 :(得分:1)
@demisbellot刚刚在mailing list回复了我们,他的猜测是正确的:我们错过了SearchTearm属性的[DataMember]属性。
显然,这已经成为最新版ServiceStack的选择。