Quantcast
Channel: ASPNETWebStack Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 7215

Commented Feature: ExpandoObject Suppport in ODataComplexTypeSerializer [911]

$
0
0
Add Expandobject support for default OData formatters to handle dynamic results e.g. List<ExpandoObject>

At the moment the ODataComplexSerializer and ODataComplexDeserializer assume that the resource object is a strongly typed object and use reflection to Get and Setproperty values. In the case of objects from the System.Dynamic namespace e.g. ExpandoObect this approach will not work.

Change the serialization process to check if the object is of type IDictionary<string,object> before attempting to user reflection

e.g. in CreateOdataValue

var objects = graph as IDictionary<string,object>();
object propertyValue = objects != null ? objects[property.Name] : graph.GetType().GetProperty(property.Name).GetValue(graph, index:null);

Notes:
1) This could change could also improve performance as the reflection overhead is removed.
Comments: Looking to implement this issue in fork [untypedformatter](https://aspnetwebstack.codeplex.com/SourceControl/network/forks/garchibald/untypedformatter).

Viewing all articles
Browse latest Browse all 7215

Trending Articles