Click here to Skip to main content
15,891,184 members
Articles / Programming Languages / C# 4.0

Custom serialization for ExpandoObjects in ASP.NET WebAPI

Rate me:
Please Sign up or sign in to vote.
5.00/5 (9 votes)
5 Dec 2012CPOL2 min read 32K   292   14  
Using dynamic or ExpandoObject is a breeze to dynamic data WebAPIs, but when serializing to XML, it can cause a brain damage sometimes :)
using System.Web.Http.Filters;
using System.Web.Mvc;
using WebAPIProject.Filters;

namespace WebAPIProject
{
    public class FilterConfig
    {
        public static void RegisterGlobalFilters(GlobalFilterCollection filters)
        {
            filters.Add(new HandleErrorAttribute());
        }

        public static void RegisterHttpFilters(HttpFilterCollection filters)
        {
            filters.Add(new ExceptionHandlingAttribute());
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
India India
is a poor software developer and thinker. Presently working on a theory of "complementary perception". It's a work in progress.

Comments and Discussions