From d3f41a8d6a7d2f9141ef667ea85b67b99d575418 Mon Sep 17 00:00:00 2001 From: Dmitrii Smirnov Date: Mon, 22 Feb 2016 10:35:10 +0300 Subject: [PATCH] * fix proxy setup for queries --- CustomizedRequestMessage.cs | 6 +++--- OData4DynamicDriver.cs | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CustomizedRequestMessage.cs b/CustomizedRequestMessage.cs index 4cff133..19a815e 100644 --- a/CustomizedRequestMessage.cs +++ b/CustomizedRequestMessage.cs @@ -1,13 +1,13 @@ +using System.Net; using Microsoft.OData.Client; namespace OData4 { public class CustomizedRequestMessage : HttpWebRequestMessage { - public CustomizedRequestMessage(DataServiceClientRequestMessageArgs args) - : base(args) + public CustomizedRequestMessage(DataServiceClientRequestMessageArgs args, IWebProxy webProxy) : base(args) { - HttpWebRequest.Proxy = LINQPad.Util.GetWebProxy(); + HttpWebRequest.Proxy = webProxy; } } } \ No newline at end of file diff --git a/OData4DynamicDriver.cs b/OData4DynamicDriver.cs index c3f5eae..148ff7a 100644 --- a/OData4DynamicDriver.cs +++ b/OData4DynamicDriver.cs @@ -281,11 +281,12 @@ public override void InitializeContext(IConnectionInfo cxInfo, object context, Q { var dsContext = (DataServiceContext)context; - dsContext.Credentials = cxInfo.GetConnectionProperties().GetCredentials(); + var properties = cxInfo.GetConnectionProperties(); + dsContext.Credentials = properties.GetCredentials(); dsContext.Configurations.RequestPipeline.OnMessageCreating += args => { - var message = new CustomizedRequestMessage(args); + var message = new CustomizedRequestMessage(args, properties.GetWebProxy()); return message; };