admin管理员组

文章数量:1287867

I noticed that starting from ServiceStack version 8.6, it is no longer possible to use anonymous types when calling REST services (unless modifying AssemblyUtils.ValidateTypeName).

Currently, I create anonymous objects and make the HTTP request. how can I handle this situation?

I noticed that starting from ServiceStack version 8.6, it is no longer possible to use anonymous types when calling REST services (unless modifying AssemblyUtils.ValidateTypeName).

Currently, I create anonymous objects and make the HTTP request. how can I handle this situation?

Share Improve this question edited Feb 24 at 3:37 w4rcT asked Feb 22 at 19:01 w4rcTw4rcT 3422 silver badges13 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

The safest way of passing an arbitrary payload is to encode it in a string (e.g. JSON or Base64) and have the client deserialize the string into the preferred type.

You could also convert it into a Dictionary<string,object> with Reflection Utils T.ToObjectDictionary() extension method and converted back into a Type with map.FromObjectDictionary<T>() extension method. This benefits from cleaner (unencoded) JSON, but using object isn't supported in non .NET Add ServiceStack Reference languages, although neither was anonymous types.

本文标签: cServicestack v86 anonymous typeStack Overflow