WCF RESTful Service Description Model (XML)

by Mwwhited 7. June 2009 12:06
One of the problems with RESTful services is not having a description language to allow for easy enumeration of services. This extension method allows for service classes to be described in an XML format that is easy to understand. public static XElement GetWebGetServices(this object input) { return new XElement("services", from method in input.GetType().GetMethods() let webInvoke = method.GetCustomAttributes(typeof(Web... [More]

Tags: , ,

Programming

Reflective XML Serializer with Recursion Detection

by Mwwhited 7. June 2009 11:06
Not being able to serialize Anonymous Types with the build in XmlSerializer was kind of a bummer for me, so I created this set of extension methods. Another feature I added at recursion detection based on the .GetHasCode() to prevent recursive object graphs from causing stack overflows. It's ugly... but it works... I was going for a proof of concept so I'm happy for now. -Enjoy, Matt using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Xml.Lin... [More]

Tags: , , , ,

Programming

XmlResult for ASP.Net MVC

by Mwwhited 7. June 2009 05:06
Not sure why Microsoft didn't include a ActionResult that supported XML but here you go. This version will directly support XNode, XmlNode, Data Contracts, and then try to use the standard XmlSerializer. Enjoy... using System; using System.Linq; using System.Runtime.Serialization; using System.Text; using System.Web; using System.Web.Mvc; using System.Xml; using System.Xml.Linq; using System.Xml.Serialization; using WhitedUS.Common; namespace WhitedUS.Web.Mvc { public class ... [More]

Tags: , , ,

Programming

Powered by BlogEngine.NET 1.5.0.7
Theme by Mads Kristensen

RecentPosts

Badges