locked
NamedStream MimeType for ObjectContextServiceProvider in WCF Data Services 5.0 RRS feed

  • Question

  • I'm using a WCF Data Services 5.0 DataService<T> where the context is an Entity Framework 4.0 ObjectContext.

    I have added a NamedStreamAttribute to one of my entities.

    I noticed that the ResourceProperty arguments in IDataServiceStreamProvider2 have a MimeType property.

    My question is: how do I populate this MimeType property? Can I specify it in the ObjectContext's CSDL?

    Thanks in advance.


    • Edited by HC, Tuesday, April 10, 2012 5:21 AM
    Tuesday, April 10, 2012 5:19 AM

Answers

  • Hi,

    The ResourceProperty.MimeType property can only be used on a primitive properties (and named stream property is not considered a primitive property in this sense). So there's currently no way to specify this in the CSDL.

    The way to specify a content type for named streams is to implement the IDataServiceStreamProvider2.GetStreamContentType method.

    Thanks,


    Vitek Karas [MSFT]

    Tuesday, April 10, 2012 7:02 AM
    Moderator