Project Description
FluentDataContract provides a fluent configuration API to apply commonly needed serialization options to a POCO (and it's properties).

I originally called this FluentJson.NET, but realized it would be better to abstract it to a general serialization attribute replacement in the same way FluentValidation is a validation attribute replacement. Following FluentValidation as a template, with (at the moment) Json.NET in mind, FluentDataContract was born. Note that the use of DataContract does not mean this is for WCF. This is not a WCF thingy (although an adapter could be made for it).

Available on NuGet as

public class Apple
    public int Id { get; set; }
    public string Colour { get; set; }
    public DateTime Expiry { get; set; }
    public object SomethingNullable { get; set; }

public class AppleContract : AbstractDataContract<Apple>
    public AppleContract()
                .IncludeProperty(o => o.Colour)
                .IncludeProperty(o => o.Expiry)
                .IncludeProperty(o => o.SomethingNullable).ExcludeNullValues();

Last edited Jul 16, 2012 at 3:54 AM by GeorgeR, version 5