Supporting HasStream with System.Web.Http.OData implementation

Topics: ASP.NET Web API
Jan 19, 2013 at 2:23 PM
Edited Jan 19, 2013 at 2:24 PM

Hi,

We are trying to use Web API and OData. Some of our entities need to support streams, and it seems like support for HasStream on the metadata and correctly configuring the ODataEntry as a MediaResource are not supported yet. We have managed to get HasStream into the metadata but we need the ODataEntry to be marked with the media resource stream reference. Currently, in ODataEntityTypeSerializer the WriteEntry method does not support it, and neither is it overridable:

private void WriteEntry(object graph, IEnumerable<ODataProperty> propertyBag, ODataWriter writer,
	                    ODataSerializerContext writeContext)
{
	... 
	ODataEntry entry = new ODataEntry
	{
		TypeName = typeName,
		Properties = propertyBag,
		Actions = CreateActions(entityInstanceContext, writeContext),
		MediaResource = *something* < missing!!
	};
	... 
}

Is there a plan for supporting HasStream or is there a way in which we can provide support ourselves via a workaround?

Thanks!

Josh

Jan 22, 2013 at 4:14 PM

Right now, the formatter lacks the extensibility points for implementing MLE and named resource streams. We are considering making the formatter more extensible as well as supporting named streams and MLE OOB for vNext.