/// <summary>
        /// Use the KickStart extension to configure AutoMapper.
        /// </summary>
        /// <param name="configurationBuilder">The configuration builder.</param>
        /// <param name="configure">The <see langword="delegate"/> to configure AutoMapper options.</param>
        /// <returns>
        /// A fluent <see langword="interface"/> to configure KickStart.
        /// </returns>
        /// <example>Configure AutoMapper on application startup
        /// <code><![CDATA[
        /// Kick.Start(config => config
        ///     .IncludeAssemblyFor<UserProfile>()
        ///     .UseAutoMapper(c => c
        ///         .Validate()
        ///         .Initialize(map => map.AddGlobalIgnore("SysVersion"))
        ///     )
        ///     .LogLevel(TraceLevel.Verbose)
        /// );]]></code>
        /// </example>
        public static IConfigurationBuilder UseAutoMapper(this IConfigurationBuilder configurationBuilder, Action<IAutoMapperBuilder> configure)
        {
            var options = new AutoMapperOptions();
            var service = new AutoMapperStarter(options);

            if (configure != null)
            {
                var builder = new AutoMapperBuilder(options);
                configure(builder);
            }

            configurationBuilder.ExcludeName("AutoMapper");
            configurationBuilder.Use(service);

            return configurationBuilder;
        }
Exemple #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AutoMapperBuilder"/> class.
 /// </summary>
 /// <param name="options">The AutoMapperOptions to configure.</param>
 public AutoMapperBuilder(AutoMapperOptions options)
 {
     _options = options;
 }
Exemple #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AutoMapperStarter"/> class.
 /// </summary>
 /// <param name="options">The options to use.</param>
 public AutoMapperStarter(AutoMapperOptions options)
 {
     _options = options;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="AutoMapperBuilder"/> class.
 /// </summary>
 /// <param name="options">The AutoMapperOptions to configure.</param>
 public AutoMapperBuilder(AutoMapperOptions options)
 {
     _options = options;
 }