This file contains hidden or 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() | |
{ | |
ObjectFactory.Configure(cfg => | |
{ | |
cfg.For<IEmailValidator>().Use<EmailValidator>(); | |
}); |
This file contains hidden or 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 hidden or 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 IHttpController Create( | |
HttpRequestMessage request, | |
HttpControllerDescriptor controllerDescriptor, | |
Type controllerType) | |
{ | |
var scope = request.GetDependencyScope() as StructureMapDependencyScope; | |
// Inject the current request into the underlying container | |
scope.Container.Inject<HttpRequestMessage>(request); |
This file contains hidden or 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
/// <summary> | |
/// Represents a username/password type login | |
/// </summary> | |
public class FabrikLogin | |
{ | |
public const string FabrikLoginProviderId = "fabrik"; | |
/// <summary> | |
/// A unique identifier for the login. | |
/// </summary> |
This file contains hidden or 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
<?xml version="1.0" encoding="utf-8"?> | |
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
<!-- | |
This shows how you can get the name of the generated assembly when building a project | |
using the MSBuild task. | |
Note: the result of this is shown at https://dl.dropbox.com/u/40134810/twitter/msbuild-target-outputs.png | |
--> | |
<!-- The .csproj/.vbproj files to build, this can be named whatever you want --> |
This file contains hidden or 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
//This is test setup | |
var mockTeamFoundationFeatureAvailabilityService = new Mock<ITeamFoundationFeatureAvailabilityService>(); | |
var testable = new ApiFeatureAvailabilityController(x => mockTeamFoundationFeatureAvailabilityService.Object); | |
var request = new HttpRequestMessage(HttpMethod.Get, "http://localhost:8080/path"); | |
var config = new HttpConfiguration(); | |
config.Routes.MapHttpRoute("FeatureAvailability", "path/{id}", new { Controller = "ApiFeatureAvailability", id = RouteParameter.Optional }); | |
request.Properties[HttpPropertyKeys.HttpConfigurationKey] = config; | |
request.Properties[HttpPropertyKeys.HttpRouteDataKey] = config.Routes.GetRouteData(request); | |
testable.Url = new UrlHelper(request); | |
testable.Request = request; |
This file contains hidden or 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
cmd /C "webpicmdline\webpicmdline.exe /AcceptEula /SuppressReboot /Products:WindowsInstaller31" | |
cmd /C "webpicmdline\webpicmdline.exe /AcceptEula /SuppressReboot /Products:WindowsInstaller45" | |
# Powershell | |
cmd /C "webpicmdline\webpicmdline.exe /AcceptEula /SuppressReboot /Products:PowerShell" | |
cmd /C "webpicmdline\webpicmdline.exe /AcceptEula /SuppressReboot /Products:PowerShell2" | |
# .NET | |
cmd /C "webpicmdline\webpicmdline.exe /AcceptEula /SuppressReboot /Products:NETFramework20SP2" | |
cmd /C "webpicmdline\webpicmdline.exe /AcceptEula /SuppressReboot /Products:NETFramework35" |
This file contains hidden or 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
<site name="WebSite1" id="1" serverAutoStart="true"> | |
<application path="/"> | |
<virtualDirectory path="/" physicalPath="C:\PathToWebSite" /> | |
</application> | |
<bindings> | |
<binding protocol="http" bindingInformation=":1151:localhost" /> | |
<binding protocol="http" bindingInformation="*:1151:pswin8mac.local" /> | |
</bindings> | |
</site> |
This file contains hidden or 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 System; | |
using System.Net; | |
using System.Net.Http; | |
using System.Web.Http; | |
using System.Web.Http.SelfHost; | |
namespace WebApiSelfHost | |
{ | |
class Program | |
{ |
This file contains hidden or 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 HttpResponseMessage<T> : HttpResponseMessage | |
{ | |
public HttpResponseMessage(HttpRequestMessage request, T value) | |
{ | |
var config = request.GetConfiguration(); | |
var contentNegotiator = config.Services.GetContentNegotiator(); | |
var connegResult = contentNegotiator.Negotiate( | |
typeof(T), request, config.Formatters | |
); | |
request.CreateResponse(HttpStatusCode.Accepted, value); |