Skip to content

Customisation through the fluent api

isaacabraham edited this page Dec 22, 2012 · 14 revisions

###Overview The fluent API allows you to have all of your customisations placed in one (or many) classes that return a collection of customisations. This class must simply implement the IAutomapperConfigProvider interface.

    class MyCAutomapperConfigProvider : IAutomapperConfigProvider
    {
        public AutomapperConfig CreateConfiguration() {
            return AutomapperConfig.Create()
                                   .AndUseMultimappingFor(typeof(ICommand))
                                   .AndUsePolicyInjectionFor(typeof(ICommand))
                                   .AndUseNamedMappingFor(typeof(BackupCommand), "Backup")
                                   .AndUseNamedMappingFor(typeof(CloseApplicationCommand), "Quit");
        }
    }

The config above mirrors that of the attribute customisation sample, so you can compare and constract the two.

Typically you will create one

Clone this wiki locally