public static IHomeAssistantMqttConfigurationBuilder AddLight( this IHomeAssistantMqttConfigurationBuilder configurationBuilder, Func <ILightMqttEntityConfigurationBuilder, ILightMqttEntityConfigurationBuilder> configurator) { ILightMqttEntityConfigurationBuilder builder = new LightMqttEntityConfigurationBuilder(); builder = configurator(builder); configurationBuilder.ServiceCollection.AddSingleton(sp => { var entityConfiguration = builder.Build(); return(entityConfiguration); }); return(configurationBuilder); }
public static IHomeAssistantMqttConfigurationBuilder AddLight( this IHomeAssistantMqttConfigurationBuilder configurationBuilder, Func <ILightMqttEntityConfigurationBuilder, ILightMqttEntityConfigurationBuilder> configurator) { configurationBuilder.TryRegisterEntityBindingManager <ILightMqttEntityConfiguration, ILight, ILightEntityDefinition>(); ILightMqttEntityConfigurationBuilder builder = new LightMqttEntityConfigurationBuilder(); builder = configurator(builder); configurationBuilder.ServiceCollection.AddSingleton(sp => { var entityConfiguration = builder.Build(); return(entityConfiguration); }); return(configurationBuilder); }