• Automatic unflattening with AutoMapper

    AutoMapper is commonly used for flattening - converting a complex object to a simpler flattened object. However the reverse functionality, mapping from flat to complex objects, is not possible out of the box without defining a custom mapping.

    I recently wrote an extension method for convention-based unflattening, allowing Unflatten() to be configured for any property on any type:

    Mapper.CreateMap<FlattenedBlogPost, BlogPost>()
      .ForMember(m => m.Author, o => o.Unflatten());

    This post explains how it works and how you can extend this functionality further.

    Read more...

  • Microsites: Maintaining shared content for a clean user experience

    Microsites. We all know how good they are for coping with the business needs of several projects all operating under one brand, for developers pushing changes without conflicts and for making small, low-risk, frequent releases. Changes involving one product can made without affecting another, meanwhile the average site visitor is blissfully unaware as they flow seamlessly across your site.

    That is - until we need to update anything common across all our sites and find our deployments go dreadfully out of sync.

    Illustration

    Our seamless experience transforms into a multi-branded mess, at best looking unprofessional and at worst confusing the user and driving them away. Whilst this is an extreme example, even small changes such as a simple fix to a broken link might be pushed to some sites and missed in others, not to mention the time taken to go through this process with every change and dealing with any sites which have work in progress and are not production-ready.

    Managing updates to common headers, footers and sidebars can be a challenge when working across microsite deployments. An update to your site header in a monolithic site deployment typically requires one change to a layout file - updates made here apply to all other pages. The popularity of microsites introduces a new challenge - how can a similar change be made to a common layout without re-releasing every microsite too?

    This post summarises the solution I introduced at JustGiving when faced with this challenge during its first microsite rollout last year.

    Read more...

  • Catch Up

    Hi, you’ve found the place where I’ll be sharing things I’ve worked on or found interesting in some way. Some posts will be a catch-up of things from the past year or so as I’ve just got around to starting this blog, and others will be from ongoing experiences. Comments are more than welcome if there’s anything you can add!

    You can also contact me or subscribe to see what’s to come.

    Read more...