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 class FormatterCollectionExtensions | |
{ | |
public static Tuple<MediaTypeFormatter,MediaTypeHeaderValue> Negotiate<T>(this MediaTypeFormatterCollection formatters, HttpRequestMessage requestMessage) | |
{ | |
var formatSelector = new FormatterSelector(); | |
MediaTypeHeaderValue mediaType = null; | |
var response = new HttpResponseMessage() {RequestMessage = requestMessage}; | |
var formatter = formatSelector.SelectWriteFormatter(typeof(T), new FormatterContext(response, false), formatters, out mediaType); |
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 SimpleObjectContent<T> : HttpContent | |
{ | |
private readonly T _outboundInstance; | |
private readonly HttpContent _inboundContent; | |
private readonly MediaTypeFormatter _formatter; | |
// Outbound constructor | |
public SimpleObjectContent(T outboundInstance, MediaTypeFormatter formatter) | |
{ | |
_outboundInstance = outboundInstance; |
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.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Xml.Linq; | |
using System.Linq; | |
namespace LinqApplePropertyList { | |
class Program { | |
static void Main(string[] args) { |
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
WITH XMLNAMESPACES(DEFAULT 'http://www.w3.org/2005/Atom') | |
SELECT 'Customers' AS 'title', | |
'' AS 'subtitle', | |
'http://tavis.net/Customers' AS 'id', | |
REPLACE(CONVERT(varchar,(SELECT MAX(COALESCE(ModifiedDate,CreatedDate)) FROM tblCustomer), 121),' ','T') + 'Z' AS 'updated', | |
(SELECT cu.Code AS 'title', | |
REPLACE(CONVERT(varchar,COALESCE(ModifiedDate,CreatedDate) , 121),' ','T') + 'Z' AS 'updated', | |
'Darrel Miller' AS 'author/name', | |
'http://tavis.net/Customer/' + LTRIM(STR(cu.ID)) AS 'id', | |
(SELECT * |
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
var hal = HalDocument.Create(new Uri("http://example.org")); | |
hal.AddNamespace("td", new Uri("http://mytodoapp.com/rels/")); | |
hal.AddLink("td:search", new Uri("/todo-list/search;{searchterm}",UriKind.Relative)); | |
hal.AddLink("td:description", new Uri("/todo-list/description", UriKind.Relative)); | |
hal.AddProperty("created_at", "2010-01-16"); | |
hal.AddProperty("updated_at", "2010-02-21"); | |
hal.AddProperty("summary", "An example list"); | |
hal.CreateResource("td:owner", new Uri("http://range14sux.com/mike")) |
NewerOlder