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 EtagMessageHandler : DelegatingChannel | |
| { | |
| readonly IETagStore _eTagStore; | |
| public EtagMessageHandler(HttpMessageChannel innerChannel) : base(innerChannel) { | |
| Trace.WriteLine("EtagMessageHandler - Ctor"); | |
| _eTagStore = new InMemoryETagStore(); | |
| } |
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
| Get-ChildItem $wcfsource -Exclude "*.StyleCop" -Recurse | %{Copy-Item $_.FullName -Destination ($hgroot + $_.FullName.Substring($wcfsource.Length)) -Force} |
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
| Import-Module Pscx | |
| # the variables you'll likely need to change on your local machine | |
| $afroot = "D:\AppFabric" | |
| $hgroot = 'D:\Programming Projects' | |
| # $hgremote = "https://hg01.codeplex.com/wcf" | |
| $hgremote = "D:\Programming Projects\wcf-codeplex-baseline_RC2" | |
| # derived paths | |
| $afwcfsource = $afroot + "\private\source\WCF" |
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"?> | |
| <xsl:stylesheet version="1.0" | |
| xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
| xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl b" | |
| xmlns:b="http://schemas.microsoft.com/developer/msbuild/2003"> | |
| <xsl:output method="xml" indent="yes" encoding="UTF-8"/> | |
| <xsl:template match="/b:Project"> | |
| <xsl:copy> |
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
| class MyCustomMediaTypeFormatter : MediaTypeFormatter | |
| { | |
| public MyCustomMediaTypeFormatter() { | |
| SupportedMediaTypes.Add(new MediaTypeHeaderValue("application/vnd.howard.fancyformat")); | |
| } | |
| protected override object OnReadFromStream(Type type, Stream stream, HttpContentHeaders contentHeaders) { | |
| //stuff | |
| } |
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 OAuthFacebookOpHandler : HttpOperationHandler<HttpRequestMessage, HttpRequestMessage> { | |
| readonly Uri _facebookBaseAuthUri = new Uri("https://www.facebook.com/dialog/oauth"); | |
| readonly AuthorizeAttribute _authorizationAttribute; | |
| readonly string _facebookAppId; | |
| public OAuthFacebookOpHandler() : base("response") { } | |
| public OAuthFacebookOpHandler(AuthorizeAttribute authorizeAttribute, string appId) : this() { | |
| _authorizationAttribute = authorizeAttribute; | |
| _facebookAppId = appId; |
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
| function GetCommentsWithOAuth(){ | |
| viewModel.comments([]); | |
| $.ajax({ url: "/services/comments/oauth", | |
| accepts: "application/json", | |
| cache: false, | |
| statusCode: { | |
| 200: function(data){ | |
| viewModel.comments(data); | |
| }, | |
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 OAuthFacebookMessageHandler : DelegatingHandler | |
| { | |
| static readonly Uri FacebookBaseGraphUri = new Uri("https://graph.facebook.com/me"); | |
| static readonly Uri FacebookAccessTokenBaseUri = new Uri("https://graph.facebook.com/oauth/access_token"); | |
| readonly string _facebookAppId; | |
| readonly string _facebookAppSecret; | |
| public OAuthFacebookMessageHandler(string appId, string secret) { | |
| _facebookAppId = appId; | |
| _facebookAppSecret = secret; |
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 static void RegisterOAuth(this HttpConfiguration config, FacebookOAuthClient client) { | |
| var existingFactory = config.RequestHandlers; | |
| config.RequestHandlers = (c, e, od) => { | |
| if (existingFactory != null) | |
| existingFactory(c, e, od); | |
| var authorizeAttribute = od.Attributes.OfType<AuthorizeAttribute>().FirstOrDefault(); | |
| if (authorizeAttribute == null) return; | |
| if (od.Name == "GetCommentsOauth") { |
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
| [ServiceContractAttribute(Namespace = "http://microsoft.samples")] | |
| public interface ISampleService | |
| { | |
| [OperationContractAttribute] | |
| string SampleMethod(string msg); | |
| [OperationContractAttribute(AsyncPattern = true)] | |
| IAsyncResult BeginSampleMethod(string msg, AsyncCallback callback, | |
| object asyncState); |
OlderNewer