/// <summary> /// Writes the log entry using the specified action after the execute strategy is invoked. /// </summary> /// <param name="configuration">The configuration.</param> /// <param name="action">The logging action to call.</param> /// <returns>The execute strategy to invoke.</returns> /// <exception cref="ArgumentNullException">The <paramref name="configuration" /> parameter is <c>null</c>.</exception> /// <exception cref="ArgumentNullException">The <paramref name="action" /> parameter is <c>null</c>.</exception> public static IExecuteStrategy WriteLog(this IBuildConfiguration configuration, Action <string> action) { configuration = configuration ?? throw new ArgumentNullException(nameof(configuration)); action = action ?? throw new ArgumentNullException(nameof(action)); return(configuration.UsingExecuteStrategy <DefaultExecuteStrategy>().WriteLog(action)); }
/// <summary> /// Populates the specified instance using the provided build configuration. /// </summary> /// <typeparam name="T">The type of instance to populate.</typeparam> /// <param name="buildConfiguration">The build configuration to use.</param> /// <param name="instance">The instance to populate.</param> /// <returns>The updated instance.</returns> /// <exception cref="ArgumentNullException">The <paramref name="buildConfiguration" /> parameter is <c>null</c>.</exception> public static T Populate <T>(this IBuildConfiguration buildConfiguration, T instance) where T : notnull { buildConfiguration = buildConfiguration ?? throw new ArgumentNullException(nameof(buildConfiguration)); instance = instance ?? throw new ArgumentNullException(nameof(instance)); return(buildConfiguration.UsingExecuteStrategy <DefaultExecuteStrategy <T> >().Populate(instance)); }
/// <summary> /// Creates an instance of a type using the specified build configuration and any provided constructor arguments. /// </summary> /// <param name="buildConfiguration">The build configuration to create the instance with.</param> /// <param name="instanceType">The type of instance to create.</param> /// <param name="args">The constructor arguments to create the type with.</param> /// <returns>The new instance.</returns> /// <exception cref="ArgumentNullException">The <paramref name="buildConfiguration" /> parameter is <c>null</c>.</exception> /// <exception cref="ArgumentNullException">The <paramref name="instanceType" /> parameter is <c>null</c>.</exception> /// <remarks>This method uses <see cref="DefaultExecuteStrategy" /> to create the instance.</remarks> public static object Create(this IBuildConfiguration buildConfiguration, Type instanceType, params object?[]?args) { buildConfiguration = buildConfiguration ?? throw new ArgumentNullException(nameof(buildConfiguration)); instanceType = instanceType ?? throw new ArgumentNullException(nameof(instanceType)); return(buildConfiguration.UsingExecuteStrategy <DefaultExecuteStrategy>().Create(instanceType, args)); }
/// <summary> /// Creates an instance of <typeparamref name="T" /> using the specified build configuration and any provided /// constructor arguments. /// </summary> /// <typeparam name="T">The type of instance to create.</typeparam> /// <param name="buildConfiguration">The build configuration to create the instance with.</param> /// <param name="args">The constructor arguments to create the type with.</param> /// <returns>The new instance.</returns> /// <exception cref="ArgumentNullException">The <paramref name="buildConfiguration" /> parameter is <c>null</c>.</exception> /// <remarks>This method uses <see cref="DefaultExecuteStrategy{T}" /> to create the instance.</remarks> public static T Create <T>(this IBuildConfiguration buildConfiguration, params object?[]?args) where T : notnull { buildConfiguration = buildConfiguration ?? throw new ArgumentNullException(nameof(buildConfiguration)); return(buildConfiguration.UsingExecuteStrategy <DefaultExecuteStrategy <T> >().Create(args)); }