Custom headers with DataServiceContext

First I would like to say that I found out about LinqPad today and that I find it totally awesome! :)

Second I have a small problem using a DataServiceContext and custom headers, it looks like the headers are not included when I use a DataServiceContext. I'm using c# statements like this:

var ctx = new DataServiceContext(new Uri("https://my/odata"));
ctx.AddObject("MyObject", newObject);
ctx.SaveChanges();

And this doesn't include the custom header, but when I use c# statements like this:

MyObject.Take (100);
MyObject.Dump("");

It does include the custom headers. I know this is Beta functionality but I wonder if this is by design, a bug, or if I do something wrong.

Thanks a lot in advance, and again thanks for a nice product!

Comments

  • I wouldn't expect LINQPad to add custom headers in this case, because you've created a new context that it doesn't know about.

    What happens if you use the context that LINQPad creates? In other words:

    var ctx = this;
    ctx.AddObject("MyObject", newObject);
    ctx.SaveChanges();
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!