Ejemplo n.º 1
0
        public static IHomeAssistantMqttConfigurationBuilder AddFan(
            this IHomeAssistantMqttConfigurationBuilder configurationBuilder,
            Func <IFanMqttEntityConfigurationBuilder, IFanMqttEntityConfigurationBuilder> configurator)
        {
            IFanMqttEntityConfigurationBuilder builder = new FanMqttEntityConfigurationBuilder();

            builder = configurator(builder);

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

            return(configurationBuilder);
        }
Ejemplo n.º 2
0
        public static IHomeAssistantMqttConfigurationBuilder AddFan(
            this IHomeAssistantMqttConfigurationBuilder configurationBuilder,
            Func <IFanMqttEntityConfigurationBuilder, IFanMqttEntityConfigurationBuilder> configurator)
        {
            configurationBuilder.TryRegisterEntityBindingManager <IFanMqttEntityConfiguration, IFan, IFanEntityDefinition>();

            IFanMqttEntityConfigurationBuilder builder = new FanMqttEntityConfigurationBuilder();

            builder = configurator(builder);

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

            return(configurationBuilder);
        }