1

Is there anyway to do the same thing as AddQueryOptions but when doing a POST through a OData web service? For exemple:

var first = ctx.JobGLJournal.AddQueryOptions("tenant", "fr").First();

The POST url also need this "tenant" but I can't find any way to add it when doing a SaveChanges. if I ommit it, it will throw a server credential error. Also it doesn't work to initialize the DataServiceContext with the tenant.

POST url:

http://localhost:8058/OData/Company('xxx')/JobGLJournal?tenant=fr

1 Answers1

1

sorted it out... need to add a BuildingRequest event

   ctx.BuildingRequest += Ctx_BuildingRequest;

and in the Ctx_BuildingRequest, change the RequestUri

    private static void Ctx_BuildingRequest(object sender, 
System.Data.Services.Client.BuildingRequestEventArgs e) {
      e.RequestUri = new Uri(e.RequestUri.AbsoluteUri + "?tenant=fr");
    }