tabs ↹ over ␣ ␣ ␣ spaces

by Jiří {x2} Činčura

Multiple MimeType attribute for OData service

12 Nov 2012 OData/Data Services (Astoria)

I was recently doing my course on Entity Framework (drop me a line, if you’re interested) and the last day we were diving into WCF Data Services aka OData.

There’s a MimeType attribute that allows you, simply speaking, set the MIME type for the output of some operation. That’s great, because you can immediately provide i.e. text/html output where the HTML is saved in come column in database. But it’s a fair need to want to specify the MIME type for operations you have. Sadly the MimeType attribute has to be on class and has AllowMultiple = false. Bummer.

After some poking around, research etc. I found that there’s indeed a limitation that you currently cannot specify the MIME type for more than one operation. But good news is, that in future release(s) this limitation should be lifted.

Wondering how’s possible I never thought about this myself before??? 😃

Profile Picture Jiří Činčura is an independent developer focusing on data and business layers, language constructs, parallelism and databases. Specifically Entity Framework, asynchronous and parallel programming, cloud and Azure. He's Microsoft Most Valuable Professional and you can read his articles, guides, tips and tricks at