public static void AddBuildService(this IServiceCollection services, BuildMethodType type) { if (services == null) { throw new ArgumentNullException(nameof(services)); } switch (type) { case BuildMethodType.Docker: services.AddSingleton <IBuildService, DockerBuildService>(); break; default: throw new ArgumentOutOfRangeException(nameof(type), type, null); } }
private static object BuildMethodSettingFrom(BuildMethodType buildMethodType, IConfiguration configuration) { return(buildMethodType.GetBuildMethodSettingType().InvokeMember(null, BindingFlags.CreateInstance, null, null, new object[] { configuration })); }
public BuildSetting(IConfiguration configuration) { _buildMethodType = BuildMethodTypeFrom(configuration.GetValue <string>("Method")); _buildMethodSetting = BuildMethodSettingFrom(_buildMethodType, configuration.GetSection("Config")); }