If you follow me on Twitter, chances are you heard we released a set of Salesforce Toolkits for .NET last week. The reception has been extraordinary, and I’m so excited to see the applications developers build using these toolkits!
Take a look at the various annoucements and posts:
Wade Wegner: Announcing the Salesforce Toolkits for .NET
Developer Force Team Blog: Announcing the Salesforce Toolkits for .NET
Richard Seroter: Using the New Salesforce Toolkit for .NET
Nathen Dress: Force.com Toolkit for .NET Initial Review
(Incidently, if you know of other posts I’ve missed, please let me know!)
Just because we released doesn’t mean I’ve stopped working. In fact, I’ve been monitoring feedback via Twitter and Github, and today made a few worthwhile optimizations. It was rightly pointed out to me by Darrel Miller that the ServiceHttpClient did not optimally use the HttpClient library. Specifically:
The Developer.Common library created a new HttpClient each time. This can be an extremely expensive operation.
There was no way to modify the HttpRequestMessage class.
There was no way to use the HttpClient across ServiceHttpClient and AuthenticationClient.
To fix this, a number of changes were made to the DeveloperForce.Common library.
The ServiceHttpClient now requires the HttpClient in the constructors. Given that, for most operations, the DeveloperForce.Force and DeveloperForce.Chatter libraries manage this, you will likely see no changes to any of your code. However, if you ever want to create your own HttpClient and use it to make multiple calls against the Force.com or Chatter REST APIs, you can now create it yourself and pass it in.
Similarly, the AuthenticationClient class allows you to pass in the HttpClient. However, it is not required, as I’m making the assumption some people simply want to make a call to get the token, and don’t care if the HttpClient is disposed.
Both the ServiceHttpClient and AuthenticationClient now implement IDisposable. This means you can use Using statements to dispose the HttpClient or you can call Dispose yourself.
All these updates have been released via our NuGet packages.
Here’s what it looks like in action:
I hope you find this a useful update!
Many thanks to Darrel Miller for all his great feedback!