You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
2.0 KiB
56 lines
2.0 KiB
using Application.Domain.Entities;
|
|
using Infrastructure.Extensions;
|
|
using IoT.Shared.DeviceServices.FBee;
|
|
using IoT.Shared.DeviceServices.Onvif;
|
|
using IoT.Shared.DeviceServices.SerialPort;
|
|
using IoT.Shared.Infrastructure;
|
|
using IoT.UI.Shard;
|
|
using Microsoft.AspNetCore.Builder;
|
|
using Microsoft.AspNetCore.Hosting;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Hosting;
|
|
using Microsoft.Extensions.Logging;
|
|
using System;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace IoTNode
|
|
{
|
|
public class Startup : IoTServiceStartup
|
|
{
|
|
public Startup(IConfiguration configuration, IWebHostEnvironment env) : base(configuration, env)
|
|
{
|
|
}
|
|
|
|
public override void ConfigureServices(IServiceCollection services)
|
|
{
|
|
services.AddSingleton<NodeService>();
|
|
services.AddSingleton<OnvifService>();
|
|
services.AddSingleton<FBeeService>();
|
|
//services.AddSingleton<SerialPortService>();
|
|
services.AddHostedService(o => o.GetService<NodeService>());
|
|
services.AddHostedService(o => o.GetService<OnvifService>());
|
|
services.AddHostedService(o => o.GetService<FBeeService>());
|
|
//services.AddHostedService(o => o.GetService<SerialPortService>());
|
|
base.ConfigureServices(services);
|
|
}
|
|
|
|
public override void Seed(DbContext dbContext, IServiceProvider serviceProvider, IConfiguration configuration)
|
|
{
|
|
var cpuid = Helper.Instance.GetCPUNumber();
|
|
dbContext.Set<Node>().Add(new Node
|
|
{
|
|
Name = $"½Úµã{cpuid}",
|
|
Number = cpuid,
|
|
Icon = "classroom",
|
|
Image = "/iot/classroom.jpg",
|
|
IsOnline = true,
|
|
Type = "Öǻ۽ÌÊÒ",
|
|
Template = "node.html"
|
|
});
|
|
dbContext.SaveChanges();
|
|
base.Seed(dbContext, serviceProvider, configuration);
|
|
}
|
|
}
|
|
} |