change in config.DataServiceBehavior.MaxProtocolVersion from V3.0 to V2.0 cannot revert
Asked Answered
B

1

6

I changed

config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V3

from V3 to V2 to verify that JSON output is Verbose. However, when I change it back to V3, the output is still verbose, and I have to add

?$format=application/json;odata=verbose

in order to get JSON Light. Tips on how to get it back to the correct version?

Babbling answered 8/11, 2012 at 16:58 Comment(1)
If you set the MaxProtocolVersion to V3, then application/json should return you json light and application/json;odata=verbose should return old json format. Make sure you rebuild and restart the service after changing the configuration.Droplight
D
0

To resolve this issue use can extent a partial class

namespace Project.ServiceReference
{
public partial class MyEntities : global::System.Data.Services.Client.DataServiceContext
{
    public TestDirectoryEntities(string uri)
        : base(new Uri(uri), DataServiceProtocolVersion.V3)
    {
        this.ResolveName = new global::System.Func<global::System.Type, string>   (this.ResolveNameFromType);
        this.ResolveType = new global::System.Func<string, global::System.Type>(this.ResolveTypeFromName);
        this.OnContextCreated();
    }
}
}
Duval answered 27/5, 2013 at 5:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.