Given the request “foo?Bar=baz”, our RequestResource was being populated in the past with the value “baz” in the property “Bar” of the resource.
Any idea of why this might have broken? Any recent breaking change in ServiceStack? We have upgraded from 3.9.17.0 to 3.9.32 (also fails on .33).
Cheers
The codez:
[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
}
}
Endpoint registration is:
public class AppHost
{
public AppHost()
: base("blah Host") {}
public override void Configure(Funq.Container container)
{
Routes
.Add<ItemsServiceResource>("/user/{userId}/items/")
}
}
@demisbellot just replied to us in the mailing list and he was right about his guess: we were missing the [DataMember] attribute on the SearchTearm property.
Apparently this has become opt-in in the latest versions of ServiceStack.