public static IBuildConfiguration AddTypeMappingRule <TSource, TTarget>(this IBuildConfiguration configuration) { configuration = configuration ?? throw new ArgumentNullException(nameof(configuration)); var rule = new TypeMappingRule(typeof(TSource), typeof(TTarget)); configuration.TypeMappingRules.Add(rule); return(configuration); }
/// <summary> /// Appends a new <see cref="TypeMappingRule" /> to the build configuration using the specified types. /// </summary> /// <typeparam name="TSource">The source type to use for type mapping.</typeparam> /// <typeparam name="TTarget">The target type to use for type mapping.</typeparam> /// <param name="buildConfiguration">The build configuration to update.</param> /// <returns>The build configuration with the new rule.</returns> /// <exception cref="ArgumentNullException">The <paramref name="buildConfiguration" /> parameter is <c>null</c>.</exception> public static IBuildConfiguration Mapping <TSource, TTarget>(this IBuildConfiguration buildConfiguration) { buildConfiguration = buildConfiguration ?? throw new ArgumentNullException(nameof(buildConfiguration)); var sourceType = typeof(TSource); var targetType = typeof(TTarget); var rule = new TypeMappingRule(sourceType, targetType); return(buildConfiguration.Add(rule)); }
/// <summary> /// Adds a new type mapping rule to the configuration. /// </summary> /// <param name="configuration">The configuration.</param> /// <param name="rule">The rule.</param> /// <returns>The configuration.</returns> /// <exception cref="ArgumentNullException">The <paramref name="configuration" /> parameter is <c>null</c>.</exception> /// <exception cref="ArgumentNullException">The <paramref name="rule" /> parameter is <c>null</c>.</exception> public static IBuildConfiguration Add(this IBuildConfiguration configuration, TypeMappingRule rule) { configuration = configuration ?? throw new ArgumentNullException(nameof(configuration)); rule = rule ?? throw new ArgumentNullException(nameof(rule)); configuration.TypeMappingRules.Add(rule); return(configuration); }