Created
January 6, 2015 03:20
-
-
Save ODataTeam/c006ff134167c04e7275 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CsvMediaTypeResolver : ODataMediaTypeResolver | |
{ | |
private static readonly CsvMediaTypeResolver instance = new CsvMediaTypeResolver(); | |
private readonly ODataMediaTypeFormat[] mediaTypeFormats = | |
{ | |
new ODataMediaTypeFormat(new ODataMediaType("text", "csv"), new CsvFormat()) | |
}; | |
private CsvMediaTypeResolver() { } | |
public static CsvMediaTypeResolver Instance { get { return instance; } } | |
public override IEnumerable<ODataMediaTypeFormat> GetMediaTypeFormats(ODataPayloadKind payloadKind) | |
{ | |
if (payloadKind == ODataPayloadKind.Entry || payloadKind== ODataPayloadKind.Feed) | |
{ | |
return mediaTypeFormats.Concat(base.GetMediaTypeFormats(payloadKind)); | |
} | |
return base.GetMediaTypeFormats(payloadKind); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment