Ejemplo n.º 1
0
        public static IHomeAssistantMqttConfigurationBuilder AddVacuum(
            this IHomeAssistantMqttConfigurationBuilder configurationBuilder,
            IVacuumMqttEntityConfiguration mqttEntityConfiguration)
        {
            configurationBuilder.TryRegisterEntityBindingManager <IVacuumMqttEntityConfiguration, IVacuum, IVacuumEntityDefinition>();

            configurationBuilder.ServiceCollection.AddSingleton(mqttEntityConfiguration);
            return(configurationBuilder);
        }
Ejemplo n.º 2
0
        public static IHomeAssistantMqttConfigurationBuilder AddVacuum(
            this IHomeAssistantMqttConfigurationBuilder configurationBuilder,
            Func <IVacuumMqttEntityConfigurationBuilder, IVacuumMqttEntityConfigurationBuilder> configurator)
        {
            configurationBuilder.TryRegisterEntityBindingManager <IVacuumMqttEntityConfiguration, IVacuum, IVacuumEntityDefinition>();

            IVacuumMqttEntityConfigurationBuilder builder = new VacuumMqttEntityConfigurationBuilder();

            builder = configurator(builder);

            configurationBuilder.ServiceCollection.AddSingleton(sp =>
            {
                var entityConfiguration = builder.Build();
                return(entityConfiguration);
            });

            return(configurationBuilder);
        }