Exemplo n.º 1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllersWithViews();

            services.AddOptions();
            services.Configure <AppSettings>(Configuration);
            services.AddLogging(builder =>
            {
                builder.AddConsole();
            });
            services.AddQuartzHostedService();
            services.AddTransient <Slaver>();

            services.AddSingleton(options =>
            {
                var mqtt = new IoTSharp.EdgeSdk.MQTT.MQTTClient();
                return(mqtt);
            });
        }
Exemplo n.º 2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddQuartzmin();
            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);

            services.AddOptions();
            services.Configure <AppSettings>(Configuration);
            services.AddLogging(builder =>
            {
                builder.AddConsole();
            });
            services.AddQuartzHostedService();
            services.AddTransient <Slaver>();
            services.AddHostedService <ModBusService>();
            services.AddSingleton(options =>
            {
                var mqtt = new IoTSharp.EdgeSdk.MQTT.MQTTClient();
                return(mqtt);
            });
        }