/// <summary> /// Allows configuration of custom mappings at runtime through the specified adapter factory configuration. /// </summary> /// <param name="configuration">An adapter factory configuration.</param> /// <exception cref="ArgumentNullException">Thrown when <paramref name="configuration"/> is null.</exception> protected override void ConfigureAdapter(AdapterFactoryConfiguration <TSource, TTarget> configuration) { configuration.ThrowIfNull("configuration"); _conventions = GetConventions(); ApplyConventions(configuration); ConfigureCustomMapping(configuration); }
/// <summary> /// Initializes a new instance of the <see cref="AdapterFactory{TSource,TTarget}"/> class. /// </summary> /// <param name="configuration">An adapter factory configuration.</param> /// <param name="adapterFactoryLocator">An adapter factory locator.</param> /// <param name="adapterFactoryFlags">Adapter factory flags.</param> /// <exception cref="ArgumentNullException">Thrown when <paramref name="configuration"/> is null.</exception> protected AdapterFactory(AdapterFactoryFlags adapterFactoryFlags, AdapterFactoryConfiguration <TSource, TTarget> configuration = null, IAdapterFactoryLocator adapterFactoryLocator = null) { configuration = configuration ?? new AdapterFactoryConfiguration <TSource, TTarget>(); _locator = adapterFactoryLocator == null ? new AdapterFactoryLocator() : new AdapterFactoryLocator(adapterFactoryLocator); configuration.ThrowIfNull("configuration"); _configuration = configuration; _adapterFactoryFlags = adapterFactoryFlags; _adapterFactory = new Lazy <IAdapterFactory <TSource, TTarget> >( () => { ConfigureMapping(); return(AdapterFactoryGenerator.Instance.Generate <TSource, TTarget>(_configuration.Mappings)); }); }
/// <summary> /// Allows configuration of custom mappings at runtime through the specified adapter factory configuration. /// </summary> /// <param name="configuration">An adapter factory configuration.</param> protected abstract void ConfigureCustomMapping(AdapterFactoryConfiguration <TSource, TTarget> configuration);
/// <summary> /// Initializes a new instance of the <see cref="AdapterFactory{TSource,TTarget}"/> class with default options. /// </summary> /// <param name="configuration">An adapter factory configuration.</param> /// <param name="adapterFactoryLocator">An adapter factory locator.</param> /// <exception cref="ArgumentNullException">Thrown when <paramref name="configuration"/> is null.</exception> protected AdapterFactory(AdapterFactoryConfiguration <TSource, TTarget> configuration = null, IAdapterFactoryLocator adapterFactoryLocator = null) : this(AdapterFactoryFlags.ApplyDefaultMappingConventions | AdapterFactoryFlags.ApplyRecursiveMappingConvention, configuration, adapterFactoryLocator) { }
/// <summary> /// Allows configuration of custom mappings at runtime through the specified adapter factory configuration. /// </summary> /// <param name="configuration">An adapter factory configuration.</param> protected virtual void ConfigureCustomMapping(AdapterFactoryConfiguration <TSource, TTarget> configuration) { }