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

Edited Issue: 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.

Viewing all articles
Browse latest Browse all 7215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>