public static IHomeAssistantMqttConfigurationBuilder AddCamera( this IHomeAssistantMqttConfigurationBuilder configurationBuilder, Func <ICameraMqttEntityConfigurationBuilder, ICameraMqttEntityConfigurationBuilder> configurator) { ICameraMqttEntityConfigurationBuilder builder = new CameraMqttEntityConfigurationBuilder(); builder = configurator(builder); configurationBuilder.ServiceCollection.AddSingleton(sp => { var entityConfiguration = builder.Build(); return(entityConfiguration); }); return(configurationBuilder); }
public static IHomeAssistantMqttConfigurationBuilder AddCamera( this IHomeAssistantMqttConfigurationBuilder configurationBuilder, Func <ICameraMqttEntityConfigurationBuilder, ICameraMqttEntityConfigurationBuilder> configurator) { configurationBuilder.TryRegisterEntityBindingManager <ICameraMqttEntityConfiguration, ICamera, ICameraEntityDefinition>(); ICameraMqttEntityConfigurationBuilder builder = new CameraMqttEntityConfigurationBuilder(); builder = configurator(builder); configurationBuilder.ServiceCollection.AddSingleton(sp => { var entityConfiguration = builder.Build(); return(entityConfiguration); }); return(configurationBuilder); }