This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MvcApplication : System.Web.HttpApplication | |
{ | |
protected void Application_Start() | |
{ | |
/* usual sh** ommitted for brevity */ | |
var resolver = new CustomDependencyResolver(); | |
DependencyResolver.SetResolver(resolver); | |
DataAnnotationsModelValidatorProvider.RegisterDefaultAdapterFactory( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static string[] GetCanonicalizedHeaders(HttpRequestHeaders headers) | |
{ | |
return headers | |
.Where(p => p.Key.StartsWith("x-ms-", StringComparison.InvariantCultureIgnoreCase)) | |
.Select(p => new { Name = p.Key.ToLower(), Value = p.Value.First() }) | |
.OrderBy(p => p.Name) | |
.Select(p => string.Format("{0}:{1}", p.Name, p.Value)) | |
.ToArray(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AtomPubMediaFormatter : MediaTypeFormatter | |
{ | |
private const string Atom = "application/atom+xml"; | |
public AtomPubMediaFormatter() | |
{ | |
SupportedMediaTypes.Add(new MediaTypeHeaderValue(Atom)); | |
this.AddQueryStringMapping("format", "atom", Atom); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CustomDataAnnotationsModelValidatorProvider : DataAnnotationsModelValidatorProvider | |
{ | |
private readonly IServiceProvider serviceProvider; | |
public CustomDataAnnotationsModelValidatorProvider(IServiceProvider serviceProvider) | |
{ | |
this.serviceProvider = serviceProvider; | |
DataAnnotationsModelValidatorProvider.RegisterDefaultAdapterFactory( | |
(metadata, context, attribute) => |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Configuration(IAppBuilder app) | |
{ | |
// TaskCompletionSource | |
app.Map("/streaming-api1", map => | |
{ | |
// Streaming API using SignalR | |
var connectionContext = GlobalHost.ConnectionManager.GetConnectionContext<RawConnection>(); | |
map.Run(async context => | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
internal sealed class Configuration : DbMigrationsConfiguration<SpatialDemo.Models.SpatialDemoContext> | |
{ | |
public Configuration() | |
{ | |
AutomaticMigrationsEnabled = true; | |
} | |
protected override void Seed(SpatialDemo.Models.SpatialDemoContext context) | |
{ | |
context.Locations.AddOrUpdate((x) => x.Name, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set-ExecutionPolicy RemoteSigned | |
$mongoDbPath = "C:\MongoDB" | |
$mongoDbConfigPath = "$mongoDbPath\mongod.cfg" | |
$url = "http://downloads.mongodb.org/win32/mongodb-win32-x86_64-2008plus-2.2.3.zip" | |
$zipFile = "$mongoDbPath\mongo.zip" | |
$unzippedFolderContent ="$mongoDbPath\mongodb-win32-x86_64-2008plus-2.2.3" | |
if ((Test-Path -path $mongoDbPath) -eq $True) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<appSettings> | |
<add key="aspnet:UseHostHeaderForRequestUrl" value="true"/> | |
</appSettings> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Newtonsoft.Json; | |
using System; | |
using System.Collections.Concurrent; | |
using System.Collections.Generic; | |
using System.ComponentModel.DataAnnotations; | |
using System.Diagnostics.CodeAnalysis; | |
using System.Dynamic; | |
using System.Linq; | |
using System.Linq.Expressions; | |
using System.Net; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Test] | |
public void Should_be_able_to_consume() | |
{ | |
var autoResetEvent = new AutoResetEvent(false); | |
using (var channel = connection.OpenChannel()) | |
{ | |
channel.Declare(queue); | |
var settings = new ConsumerSettings(queue) |
NewerOlder