Skip to content

Instantly share code, notes, and snippets.

@wullemsb
wullemsb / bindingconfigurationwithoutsecurity.xml
Created March 16, 2013 11:03
Binding configuration for Azure Service Bus without security
<bindings>
<netTcpRelayBinding>
<binding name="hybridBinding" connectionMode="Hybrid">
</binding>
</netTcpRelayBinding>
</bindings>
@wullemsb
wullemsb / bindingconfigurationwithsecurity.xml
Created March 16, 2013 11:36
Binding configuration for Azure Service Bus
<bindings>
<netTcpRelayBinding>
<binding name="hybridBinding" connectionMode="Hybrid">
<security mode="None"/>
</binding>
</netTcpRelayBinding>
</bindings>
@wullemsb
wullemsb / _references.js
Created March 16, 2013 12:01
ASP.NET MVC references.js
/// <reference path="bootstrap.js" />
/// <reference path="breeze.debug.js" />
/// <reference path="jquery-1.9.1.js" />
/// <reference path="knockout-2.2.1.debug.js" />
/// <reference path="moment.js" />
/// <reference path="q.js" />
/// <reference path="sammy-0.7.4.js" />
/// <reference path="toastr-1.1.5.js" />
@wullemsb
wullemsb / OrderServiceWrong.cs
Created March 22, 2013 19:34
Order Service with hard to version contract
public class OrderService
{
public OrderResponse GetOrder(Guid orderId)
{
return new OrderResponse();
}
}
@wullemsb
wullemsb / OrderServiceRight.cs
Created March 22, 2013 19:39
Order service with better versioning support
public class OrderService
{
public OrderResponse GetOrder(OrderRequest request)
{
return new OrderResponse();
}
}
public class FilenameMultipartFormDataStreamProvider : MultipartFormDataStreamProvider
{
public FilenameMultipartFormDataStreamProvider(string path) : base(path)
{
}
public override string GetLocalFileName(System.Net.Http.Headers.HttpContentHeaders headers)
{
var name = !string.IsNullOrWhiteSpace(headers.ContentDisposition.FileName) ? headers.ContentDisposition.FileName : Guid.NewGuid().ToString();
return name.Replace("\"",string.Empty);
@wullemsb
wullemsb / Reference.cs
Last active December 15, 2015 14:39
DataServiceContext generated code
namespace ODataSample
{
/// <summary>
/// There are no comments for Entities in the schema.
/// </summary>
public partial class Entities : global::System.Data.Services.Client.DataServiceContext
{
/// <summary>
/// Initialize a new Entities object.
/// </summary>
@wullemsb
wullemsb / reference.partial.cs
Created March 30, 2013 09:15
Add a certificate property to a DataServiceContext
namespace ODataSample
{
public partial class Entities
{
private X509Certificate _clientCertificate = null;
public X509Certificate ClientCertificate
{
get
{
return _clientCertificate;
@wullemsb
wullemsb / CallOdataCode.cs
Created March 30, 2013 09:18
Create an OData context and include a client certificate
Entities ctx = new Entities(new Uri(settings.Url));
ctx.ClientCertificate = new X509Certificate(settings.CertificatePath);
@wullemsb
wullemsb / hellocsharp.js
Created April 6, 2013 08:08
Hello world sample for edge.js, combining c# and node.js
var edge = require('edge');
var helloWorld = edge.func('async (input) => { return ".NET Welcomes " + input.ToString(); }');
helloWorld('JavaScript', function (error, result) {
if (error) throw error;
console.log(result);
});