diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..3729ff0
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,25 @@
+**/.classpath
+**/.dockerignore
+**/.env
+**/.git
+**/.gitignore
+**/.project
+**/.settings
+**/.toolstarget
+**/.vs
+**/.vscode
+**/*.*proj.user
+**/*.dbmdl
+**/*.jfm
+**/azds.yaml
+**/bin
+**/charts
+**/docker-compose*
+**/Dockerfile*
+**/node_modules
+**/npm-debug.log
+**/obj
+**/secrets.dev.yaml
+**/values.dev.yaml
+LICENSE
+README.md
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..b43ad92
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,20 @@
+# Build and Release Folders
+bin-debug/
+bin-release/
+[Oo]bj/
+[Bb]in/
+
+# Other files and folders
+.settings/
+
+# Executables
+*.swf
+*.air
+*.ipa
+*.apk
+
+# Project files, i.e. `.project`, `.actionScriptProperties` and `.flexProperties`
+# should NOT be excluded as they contain compiler settings and other important
+# information for Eclipse / Flash Builder.
+/LK/appsettings.json
+/LK/appsettings.json
diff --git a/.vs/IoTGateway/DesignTimeBuild/.dtbcache.v2 b/.vs/IoTGateway/DesignTimeBuild/.dtbcache.v2
new file mode 100644
index 0000000..6dfe2b3
Binary files /dev/null and b/.vs/IoTGateway/DesignTimeBuild/.dtbcache.v2 differ
diff --git a/.vs/IoTGateway/config/applicationhost.config b/.vs/IoTGateway/config/applicationhost.config
new file mode 100644
index 0000000..bd44eab
--- /dev/null
+++ b/.vs/IoTGateway/config/applicationhost.config
@@ -0,0 +1,1025 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.vs/IoTGateway/project-colors.json b/.vs/IoTGateway/project-colors.json
new file mode 100644
index 0000000..f8a58d0
--- /dev/null
+++ b/.vs/IoTGateway/project-colors.json
@@ -0,0 +1,41 @@
+{
+ "Version": 1,
+ "ProjectMap": {
+ "61d79f77-09ef-4a98-a50b-043b1d72c111": {
+ "ProjectGuid": "61d79f77-09ef-4a98-a50b-043b1d72c111",
+ "DisplayName": "Plugin",
+ "ColorIndex": 0
+ },
+ "68abbdf2-1485-4756-9a94-6afa874d69a3": {
+ "ProjectGuid": "68abbdf2-1485-4756-9a94-6afa874d69a3",
+ "DisplayName": "IoTGateway",
+ "ColorIndex": 1
+ },
+ "00e91fc1-d5cf-416a-aaaf-61567e368dcd": {
+ "ProjectGuid": "00e91fc1-d5cf-416a-aaaf-61567e368dcd",
+ "DisplayName": "IoTGateway.ViewModel",
+ "ColorIndex": 2
+ },
+ "9e7c8c77-643f-45cf-8edc-5b032c51d563": {
+ "ProjectGuid": "9e7c8c77-643f-45cf-8edc-5b032c51d563",
+ "DisplayName": "IoTGateway.DataAccess",
+ "ColorIndex": 3
+ },
+ "c2978e5d-e71e-4882-8ef1-4014e8565a77": {
+ "ProjectGuid": "c2978e5d-e71e-4882-8ef1-4014e8565a77",
+ "DisplayName": "IoTGateway.Model",
+ "ColorIndex": 4
+ },
+ "7b432fc9-57e6-44bf-b8a7-2a1fb31d6add": {
+ "ProjectGuid": "7b432fc9-57e6-44bf-b8a7-2a1fb31d6add",
+ "DisplayName": "DriverModbusTCP",
+ "ColorIndex": 5
+ },
+ "16f2c5cc-d881-4fdf-82de-d6df3525d65d": {
+ "ProjectGuid": "16f2c5cc-d881-4fdf-82de-d6df3525d65d",
+ "DisplayName": "IoTGateway.Test",
+ "ColorIndex": 6
+ }
+ },
+ "NextColorIndex": 7
+}
\ No newline at end of file
diff --git a/.vs/IoTGateway/v16/.suo b/.vs/IoTGateway/v16/.suo
new file mode 100644
index 0000000..d1925cc
Binary files /dev/null and b/.vs/IoTGateway/v16/.suo differ
diff --git a/.vs/IoTGateway/v17/.futdcache.v1 b/.vs/IoTGateway/v17/.futdcache.v1
new file mode 100644
index 0000000..ec81832
Binary files /dev/null and b/.vs/IoTGateway/v17/.futdcache.v1 differ
diff --git a/.vs/IoTGateway/v17/.suo b/.vs/IoTGateway/v17/.suo
new file mode 100644
index 0000000..f7b2e7b
Binary files /dev/null and b/.vs/IoTGateway/v17/.suo differ
diff --git a/.vs/IoTGateway/v17/TestStore/0/007.testlog b/.vs/IoTGateway/v17/TestStore/0/007.testlog
new file mode 100644
index 0000000..3f0c85c
Binary files /dev/null and b/.vs/IoTGateway/v17/TestStore/0/007.testlog differ
diff --git a/.vs/IoTGateway/v17/TestStore/0/testlog.manifest b/.vs/IoTGateway/v17/TestStore/0/testlog.manifest
new file mode 100644
index 0000000..006f9b0
Binary files /dev/null and b/.vs/IoTGateway/v17/TestStore/0/testlog.manifest differ
diff --git a/.vs/IoTGateway/v17/fileList.bin b/.vs/IoTGateway/v17/fileList.bin
new file mode 100644
index 0000000..ffcb6e7
Binary files /dev/null and b/.vs/IoTGateway/v17/fileList.bin differ
diff --git a/IoTGateway.DataAccess/DataContext.cs b/IoTGateway.DataAccess/DataContext.cs
new file mode 100644
index 0000000..55bd93f
--- /dev/null
+++ b/IoTGateway.DataAccess/DataContext.cs
@@ -0,0 +1,86 @@
+using System.Linq;
+using System.Threading.Tasks;
+using IoTGateway.Model;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Design;
+using WalkingTec.Mvvm.Core;
+
+namespace IoTGateway.DataAccess
+{
+ public class DataContext : FrameworkContext
+ {
+ public DbSet FrameworkUsers { get; set; }
+ public DbSet Devices { get; set; }
+ public DbSet DeviceConfigs { get; set; }
+ public DbSet DeviceVariables { get; set; }
+ public DbSet Drivers { get; set; }
+ public DbSet SystemConfig { get; set; }
+
+
+ public DataContext(CS cs)
+ : base(cs)
+ {
+ }
+
+ public DataContext(string cs, DBTypeEnum dbtype)
+ : base(cs, dbtype)
+ {
+ }
+
+ public DataContext(string cs, DBTypeEnum dbtype, string version = null)
+ : base(cs, dbtype, version)
+ {
+ }
+
+
+ public DataContext(DbContextOptions options) : base(options) { }
+
+ public override async Task DataInit(object allModules, bool IsSpa)
+ {
+ var state = await base.DataInit(allModules, IsSpa);
+ bool emptydb = false;
+ try
+ {
+ emptydb = Set().Count() == 0 && Set().Count() == 0;
+ }
+ catch { }
+ if (state == true || emptydb == true)
+ {
+ //when state is true, means it's the first time EF create database, do data init here
+ //当state是true的时候,表示这是第一次创建数据库,可以在这里进行数据初始化
+ var user = new FrameworkUser
+ {
+ ITCode = "admin",
+ Password = Utils.GetMD5String("000000"),
+ IsValid = true,
+ Name = "Admin"
+ };
+
+ var userrole = new FrameworkUserRole
+ {
+ UserCode = user.ITCode,
+ RoleCode = "001"
+ };
+
+ Set().Add(user);
+ Set().Add(userrole);
+ await SaveChangesAsync();
+ }
+ return state;
+ }
+
+ }
+
+ ///
+ /// DesignTimeFactory for EF Migration, use your full connection string,
+ /// EF will find this class and use the connection defined here to run Add-Migration and Update-Database
+ ///
+ public class DataContextFactory : IDesignTimeDbContextFactory
+ {
+ public DataContext CreateDbContext(string[] args)
+ {
+ return new DataContext("Data Source = ../IoTGateway/iotgateway.db", DBTypeEnum.SQLite);
+ }
+ }
+
+}
diff --git a/IoTGateway.DataAccess/IoTGateway.DataAccess.csproj b/IoTGateway.DataAccess/IoTGateway.DataAccess.csproj
new file mode 100644
index 0000000..338af31
--- /dev/null
+++ b/IoTGateway.DataAccess/IoTGateway.DataAccess.csproj
@@ -0,0 +1,24 @@
+
+
+
+ net5.0
+ true
+
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
+
+
+
+
+
diff --git a/IoTGateway.DataAccess/Migrations/20211209085327_ini.Designer.cs b/IoTGateway.DataAccess/Migrations/20211209085327_ini.Designer.cs
new file mode 100644
index 0000000..01403ef
--- /dev/null
+++ b/IoTGateway.DataAccess/Migrations/20211209085327_ini.Designer.cs
@@ -0,0 +1,794 @@
+//
+using System;
+using IoTGateway.DataAccess;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+namespace IoTGateway.DataAccess.Migrations
+{
+ [DbContext(typeof(DataContext))]
+ [Migration("20211209085327_ini")]
+ partial class ini
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "5.0.9");
+
+ modelBuilder.Entity("IoTGateway.Model.Device", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("TEXT");
+
+ b.Property("AutoStart")
+ .HasColumnType("INTEGER");
+
+ b.Property("CreateBy")
+ .HasColumnType("TEXT");
+
+ b.Property("CreateTime")
+ .HasColumnType("TEXT");
+
+ b.Property("Description")
+ .HasColumnType("TEXT");
+
+ b.Property("DeviceName")
+ .HasColumnType("TEXT");
+
+ b.Property("DeviceTypeEnum")
+ .HasColumnType("INTEGER");
+
+ b.Property("DriverId")
+ .HasColumnType("TEXT");
+
+ b.Property("Index")
+ .HasColumnType("INTEGER");
+
+ b.Property("ParentId")
+ .HasColumnType("TEXT");
+
+ b.Property("UpdateBy")
+ .HasColumnType("TEXT");
+
+ b.Property("UpdateTime")
+ .HasColumnType("TEXT");
+
+ b.HasKey("ID");
+
+ b.HasIndex("DriverId");
+
+ b.HasIndex("ParentId");
+
+ b.ToTable("Devices");
+ });
+
+ modelBuilder.Entity("IoTGateway.Model.DeviceConfig", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("TEXT");
+
+ b.Property("CreateBy")
+ .HasMaxLength(50)
+ .HasColumnType("TEXT");
+
+ b.Property("CreateTime")
+ .HasColumnType("TEXT");
+
+ b.Property("Description")
+ .HasColumnType("TEXT");
+
+ b.Property("DeviceConfigName")
+ .HasColumnType("TEXT");
+
+ b.Property("DeviceId")
+ .HasColumnType("TEXT");
+
+ b.Property("EnumInfo")
+ .HasColumnType("TEXT");
+
+ b.Property("UpdateBy")
+ .HasMaxLength(50)
+ .HasColumnType("TEXT");
+
+ b.Property("UpdateTime")
+ .HasColumnType("TEXT");
+
+ b.Property("Value")
+ .HasColumnType("TEXT");
+
+ b.HasKey("ID");
+
+ b.HasIndex("DeviceId");
+
+ b.ToTable("DeviceConfigs");
+ });
+
+ modelBuilder.Entity("IoTGateway.Model.DeviceVariable", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("TEXT");
+
+ b.Property("DataType")
+ .HasColumnType("INTEGER");
+
+ b.Property("Description")
+ .HasColumnType("TEXT");
+
+ b.Property("DeviceAddress")
+ .HasColumnType("TEXT");
+
+ b.Property("DeviceId")
+ .HasColumnType("TEXT");
+
+ b.Property("Method")
+ .HasColumnType("TEXT");
+
+ b.Property("Name")
+ .HasColumnType("TEXT");
+
+ b.Property("ProtectType")
+ .HasColumnType("INTEGER");
+
+ b.Property("ValueFactor")
+ .HasColumnType("REAL");
+
+ b.HasKey("ID");
+
+ b.HasIndex("DeviceId");
+
+ b.ToTable("DeviceVariables");
+ });
+
+ modelBuilder.Entity("IoTGateway.Model.Driver", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("TEXT");
+
+ b.Property("AssembleName")
+ .HasColumnType("TEXT");
+
+ b.Property("AuthorizesNum")
+ .HasColumnType("INTEGER");
+
+ b.Property("CreateBy")
+ .HasMaxLength(50)
+ .HasColumnType("TEXT");
+
+ b.Property("CreateTime")
+ .HasColumnType("TEXT");
+
+ b.Property("DriverName")
+ .HasColumnType("TEXT");
+
+ b.Property("FileName")
+ .HasColumnType("TEXT");
+
+ b.Property("UpdateBy")
+ .HasMaxLength(50)
+ .HasColumnType("TEXT");
+
+ b.Property("UpdateTime")
+ .HasColumnType("TEXT");
+
+ b.HasKey("ID");
+
+ b.ToTable("Drivers");
+ });
+
+ modelBuilder.Entity("IoTGateway.Model.SystemConfig", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("TEXT");
+
+ b.Property("CreateBy")
+ .HasMaxLength(50)
+ .HasColumnType("TEXT");
+
+ b.Property("CreateTime")
+ .HasColumnType("TEXT");
+
+ b.Property("GatewayName")
+ .HasColumnType("TEXT");
+
+ b.Property("MqttIp")
+ .HasColumnType("TEXT");
+
+ b.Property("MqttPort")
+ .HasColumnType("INTEGER");
+
+ b.Property("MqttUName")
+ .HasColumnType("TEXT");
+
+ b.Property("MqttUPwd")
+ .HasColumnType("TEXT");
+
+ b.Property("UpdateBy")
+ .HasMaxLength(50)
+ .HasColumnType("TEXT");
+
+ b.Property("UpdateTime")
+ .HasColumnType("TEXT");
+
+ b.HasKey("ID");
+
+ b.ToTable("SystemConfig");
+ });
+
+ modelBuilder.Entity("WalkingTec.Mvvm.Core.ActionLog", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("TEXT");
+
+ b.Property("ActionName")
+ .HasMaxLength(255)
+ .HasColumnType("TEXT");
+
+ b.Property("ActionTime")
+ .HasColumnType("TEXT");
+
+ b.Property("ActionUrl")
+ .HasMaxLength(250)
+ .HasColumnType("TEXT");
+
+ b.Property("CreateBy")
+ .HasMaxLength(50)
+ .HasColumnType("TEXT");
+
+ b.Property("CreateTime")
+ .HasColumnType("TEXT");
+
+ b.Property("Duration")
+ .HasColumnType("REAL");
+
+ b.Property("IP")
+ .HasMaxLength(50)
+ .HasColumnType("TEXT");
+
+ b.Property("ITCode")
+ .HasMaxLength(50)
+ .HasColumnType("TEXT");
+
+ b.Property("LogType")
+ .HasColumnType("INTEGER");
+
+ b.Property("ModuleName")
+ .HasMaxLength(255)
+ .HasColumnType("TEXT");
+
+ b.Property("Remark")
+ .HasColumnType("TEXT");
+
+ b.Property("UpdateBy")
+ .HasMaxLength(50)
+ .HasColumnType("TEXT");
+
+ b.Property("UpdateTime")
+ .HasColumnType("TEXT");
+
+ b.HasKey("ID");
+
+ b.ToTable("ActionLogs");
+ });
+
+ modelBuilder.Entity("WalkingTec.Mvvm.Core.DataPrivilege", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("TEXT");
+
+ b.Property("CreateBy")
+ .HasMaxLength(50)
+ .HasColumnType("TEXT");
+
+ b.Property("CreateTime")
+ .HasColumnType("TEXT");
+
+ b.Property("Domain")
+ .HasColumnType("TEXT");
+
+ b.Property("GroupCode")
+ .HasColumnType("TEXT");
+
+ b.Property("RelateId")
+ .HasColumnType("TEXT");
+
+ b.Property("TableName")
+ .IsRequired()
+ .HasMaxLength(50)
+ .HasColumnType("TEXT");
+
+ b.Property("UpdateBy")
+ .HasMaxLength(50)
+ .HasColumnType("TEXT");
+
+ b.Property("UpdateTime")
+ .HasColumnType("TEXT");
+
+ b.Property("UserCode")
+ .HasColumnType("TEXT");
+
+ b.HasKey("ID");
+
+ b.ToTable("DataPrivileges");
+ });
+
+ modelBuilder.Entity("WalkingTec.Mvvm.Core.FileAttachment", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("TEXT");
+
+ b.Property("ExtraInfo")
+ .HasColumnType("TEXT");
+
+ b.Property("FileData")
+ .HasColumnType("BLOB");
+
+ b.Property("FileExt")
+ .IsRequired()
+ .HasMaxLength(10)
+ .HasColumnType("TEXT");
+
+ b.Property("FileName")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("HandlerInfo")
+ .HasColumnType("TEXT");
+
+ b.Property("Length")
+ .HasColumnType("INTEGER");
+
+ b.Property("Path")
+ .HasColumnType("TEXT");
+
+ b.Property("SaveMode")
+ .HasColumnType("TEXT");
+
+ b.Property("UploadTime")
+ .HasColumnType("TEXT");
+
+ b.HasKey("ID");
+
+ b.ToTable("FileAttachments");
+ });
+
+ modelBuilder.Entity("WalkingTec.Mvvm.Core.FrameworkGroup", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("TEXT");
+
+ b.Property("CreateBy")
+ .HasMaxLength(50)
+ .HasColumnType("TEXT");
+
+ b.Property("CreateTime")
+ .HasColumnType("TEXT");
+
+ b.Property("GroupCode")
+ .IsRequired()
+ .HasMaxLength(100)
+ .HasColumnType("TEXT");
+
+ b.Property("GroupName")
+ .IsRequired()
+ .HasMaxLength(50)
+ .HasColumnType("TEXT");
+
+ b.Property("GroupRemark")
+ .HasColumnType("TEXT");
+
+ b.Property("TenantCode")
+ .HasColumnType("TEXT");
+
+ b.Property("UpdateBy")
+ .HasMaxLength(50)
+ .HasColumnType("TEXT");
+
+ b.Property("UpdateTime")
+ .HasColumnType("TEXT");
+
+ b.HasKey("ID");
+
+ b.ToTable("FrameworkGroups");
+ });
+
+ modelBuilder.Entity("WalkingTec.Mvvm.Core.FrameworkMenu", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("TEXT");
+
+ b.Property("ActionName")
+ .HasColumnType("TEXT");
+
+ b.Property("ClassName")
+ .HasColumnType("TEXT");
+
+ b.Property("DisplayOrder")
+ .IsRequired()
+ .HasColumnType("INTEGER");
+
+ b.Property("Domain")
+ .HasColumnType("TEXT");
+
+ b.Property("FolderOnly")
+ .HasColumnType("INTEGER");
+
+ b.Property("Icon")
+ .HasMaxLength(50)
+ .HasColumnType("TEXT");
+
+ b.Property("IsInherit")
+ .HasColumnType("INTEGER");
+
+ b.Property("IsInside")
+ .IsRequired()
+ .HasColumnType("INTEGER");
+
+ b.Property("IsPublic")
+ .HasColumnType("INTEGER");
+
+ b.Property("MethodName")
+ .HasColumnType("TEXT");
+
+ b.Property("ModuleName")
+ .HasColumnType("TEXT");
+
+ b.Property("PageName")
+ .IsRequired()
+ .HasMaxLength(50)
+ .HasColumnType("TEXT");
+
+ b.Property("ParentId")
+ .HasColumnType("TEXT");
+
+ b.Property("ShowOnMenu")
+ .HasColumnType("INTEGER");
+
+ b.Property("Url")
+ .HasColumnType("TEXT");
+
+ b.HasKey("ID");
+
+ b.HasIndex("ParentId");
+
+ b.ToTable("FrameworkMenus");
+ });
+
+ modelBuilder.Entity("WalkingTec.Mvvm.Core.FrameworkRole", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("TEXT");
+
+ b.Property("CreateBy")
+ .HasMaxLength(50)
+ .HasColumnType("TEXT");
+
+ b.Property("CreateTime")
+ .HasColumnType("TEXT");
+
+ b.Property("RoleCode")
+ .IsRequired()
+ .HasMaxLength(100)
+ .HasColumnType("TEXT");
+
+ b.Property("RoleName")
+ .IsRequired()
+ .HasMaxLength(50)
+ .HasColumnType("TEXT");
+
+ b.Property("RoleRemark")
+ .HasColumnType("TEXT");
+
+ b.Property("TenantCode")
+ .HasColumnType("TEXT");
+
+ b.Property("UpdateBy")
+ .HasMaxLength(50)
+ .HasColumnType("TEXT");
+
+ b.Property("UpdateTime")
+ .HasColumnType("TEXT");
+
+ b.HasKey("ID");
+
+ b.ToTable("FrameworkRoles");
+ });
+
+ modelBuilder.Entity("WalkingTec.Mvvm.Core.FrameworkUser", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("TEXT");
+
+ b.Property("Address")
+ .HasMaxLength(200)
+ .HasColumnType("TEXT");
+
+ b.Property("CellPhone")
+ .HasColumnType("TEXT");
+
+ b.Property("CreateBy")
+ .HasMaxLength(50)
+ .HasColumnType("TEXT");
+
+ b.Property("CreateTime")
+ .HasColumnType("TEXT");
+
+ b.Property("Email")
+ .HasMaxLength(50)
+ .HasColumnType("TEXT");
+
+ b.Property("Gender")
+ .HasColumnType("INTEGER");
+
+ b.Property("HomePhone")
+ .HasMaxLength(30)
+ .HasColumnType("TEXT");
+
+ b.Property("ITCode")
+ .IsRequired()
+ .HasMaxLength(50)
+ .HasColumnType("TEXT");
+
+ b.Property("IsValid")
+ .HasColumnType("INTEGER");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(50)
+ .HasColumnType("TEXT");
+
+ b.Property("Password")
+ .IsRequired()
+ .HasMaxLength(32)
+ .HasColumnType("TEXT");
+
+ b.Property("PhotoId")
+ .HasColumnType("TEXT");
+
+ b.Property("TenantCode")
+ .HasColumnType("TEXT");
+
+ b.Property("UpdateBy")
+ .HasMaxLength(50)
+ .HasColumnType("TEXT");
+
+ b.Property("UpdateTime")
+ .HasColumnType("TEXT");
+
+ b.Property("ZipCode")
+ .HasColumnType("TEXT");
+
+ b.HasKey("ID");
+
+ b.HasIndex("PhotoId");
+
+ b.ToTable("FrameworkUsers");
+ });
+
+ modelBuilder.Entity("WalkingTec.Mvvm.Core.FrameworkUserGroup", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("TEXT");
+
+ b.Property("CreateBy")
+ .HasMaxLength(50)
+ .HasColumnType("TEXT");
+
+ b.Property("CreateTime")
+ .HasColumnType("TEXT");
+
+ b.Property("GroupCode")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("UpdateBy")
+ .HasMaxLength(50)
+ .HasColumnType("TEXT");
+
+ b.Property("UpdateTime")
+ .HasColumnType("TEXT");
+
+ b.Property("UserCode")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.HasKey("ID");
+
+ b.ToTable("FrameworkUserGroups");
+ });
+
+ modelBuilder.Entity("WalkingTec.Mvvm.Core.FrameworkUserRole", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("TEXT");
+
+ b.Property("CreateBy")
+ .HasMaxLength(50)
+ .HasColumnType("TEXT");
+
+ b.Property("CreateTime")
+ .HasColumnType("TEXT");
+
+ b.Property("RoleCode")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("UpdateBy")
+ .HasMaxLength(50)
+ .HasColumnType("TEXT");
+
+ b.Property("UpdateTime")
+ .HasColumnType("TEXT");
+
+ b.Property("UserCode")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.HasKey("ID");
+
+ b.ToTable("FrameworkUserRoles");
+ });
+
+ modelBuilder.Entity("WalkingTec.Mvvm.Core.FunctionPrivilege", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("TEXT");
+
+ b.Property("Allowed")
+ .IsRequired()
+ .HasColumnType("INTEGER");
+
+ b.Property("CreateBy")
+ .HasMaxLength(50)
+ .HasColumnType("TEXT");
+
+ b.Property("CreateTime")
+ .HasColumnType("TEXT");
+
+ b.Property("MenuItemId")
+ .HasColumnType("TEXT");
+
+ b.Property("RoleCode")
+ .HasColumnType("TEXT");
+
+ b.Property("UpdateBy")
+ .HasMaxLength(50)
+ .HasColumnType("TEXT");
+
+ b.Property("UpdateTime")
+ .HasColumnType("TEXT");
+
+ b.HasKey("ID");
+
+ b.HasIndex("MenuItemId");
+
+ b.ToTable("FunctionPrivileges");
+ });
+
+ modelBuilder.Entity("WalkingTec.Mvvm.Core.PersistedGrant", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("TEXT");
+
+ b.Property("CreationTime")
+ .HasColumnType("TEXT");
+
+ b.Property("Expiration")
+ .HasColumnType("TEXT");
+
+ b.Property("RefreshToken")
+ .HasMaxLength(50)
+ .HasColumnType("TEXT");
+
+ b.Property("Type")
+ .HasMaxLength(50)
+ .HasColumnType("TEXT");
+
+ b.Property("UserCode")
+ .HasColumnType("TEXT");
+
+ b.HasKey("ID");
+
+ b.ToTable("PersistedGrants");
+ });
+
+ modelBuilder.Entity("IoTGateway.Model.Device", b =>
+ {
+ b.HasOne("IoTGateway.Model.Driver", "Driver")
+ .WithMany()
+ .HasForeignKey("DriverId");
+
+ b.HasOne("IoTGateway.Model.Device", "Parent")
+ .WithMany("Children")
+ .HasForeignKey("ParentId");
+
+ b.Navigation("Driver");
+
+ b.Navigation("Parent");
+ });
+
+ modelBuilder.Entity("IoTGateway.Model.DeviceConfig", b =>
+ {
+ b.HasOne("IoTGateway.Model.Device", "Device")
+ .WithMany("DeviceConfigs")
+ .HasForeignKey("DeviceId");
+
+ b.Navigation("Device");
+ });
+
+ modelBuilder.Entity("IoTGateway.Model.DeviceVariable", b =>
+ {
+ b.HasOne("IoTGateway.Model.Device", "Device")
+ .WithMany("DeviceVariables")
+ .HasForeignKey("DeviceId");
+
+ b.Navigation("Device");
+ });
+
+ modelBuilder.Entity("WalkingTec.Mvvm.Core.FrameworkMenu", b =>
+ {
+ b.HasOne("WalkingTec.Mvvm.Core.FrameworkMenu", "Parent")
+ .WithMany("Children")
+ .HasForeignKey("ParentId");
+
+ b.Navigation("Parent");
+ });
+
+ modelBuilder.Entity("WalkingTec.Mvvm.Core.FrameworkUser", b =>
+ {
+ b.HasOne("WalkingTec.Mvvm.Core.FileAttachment", "Photo")
+ .WithMany()
+ .HasForeignKey("PhotoId")
+ .OnDelete(DeleteBehavior.Restrict);
+
+ b.Navigation("Photo");
+ });
+
+ modelBuilder.Entity("WalkingTec.Mvvm.Core.FunctionPrivilege", b =>
+ {
+ b.HasOne("WalkingTec.Mvvm.Core.FrameworkMenu", "MenuItem")
+ .WithMany("Privileges")
+ .HasForeignKey("MenuItemId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("MenuItem");
+ });
+
+ modelBuilder.Entity("IoTGateway.Model.Device", b =>
+ {
+ b.Navigation("Children");
+
+ b.Navigation("DeviceConfigs");
+
+ b.Navigation("DeviceVariables");
+ });
+
+ modelBuilder.Entity("WalkingTec.Mvvm.Core.FrameworkMenu", b =>
+ {
+ b.Navigation("Children");
+
+ b.Navigation("Privileges");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/IoTGateway.DataAccess/Migrations/20211209085327_ini.cs b/IoTGateway.DataAccess/Migrations/20211209085327_ini.cs
new file mode 100644
index 0000000..d73d422
--- /dev/null
+++ b/IoTGateway.DataAccess/Migrations/20211209085327_ini.cs
@@ -0,0 +1,462 @@
+using System;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+namespace IoTGateway.DataAccess.Migrations
+{
+ public partial class ini : Migration
+ {
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.CreateTable(
+ name: "ActionLogs",
+ columns: table => new
+ {
+ ID = table.Column(type: "TEXT", nullable: false),
+ ModuleName = table.Column(type: "TEXT", maxLength: 255, nullable: true),
+ ActionName = table.Column(type: "TEXT", maxLength: 255, nullable: true),
+ ITCode = table.Column(type: "TEXT", maxLength: 50, nullable: true),
+ ActionUrl = table.Column(type: "TEXT", maxLength: 250, nullable: true),
+ ActionTime = table.Column(type: "TEXT", nullable: false),
+ Duration = table.Column(type: "REAL", nullable: false),
+ Remark = table.Column(type: "TEXT", nullable: true),
+ IP = table.Column(type: "TEXT", maxLength: 50, nullable: true),
+ LogType = table.Column(type: "INTEGER", nullable: false),
+ CreateTime = table.Column(type: "TEXT", nullable: true),
+ CreateBy = table.Column(type: "TEXT", maxLength: 50, nullable: true),
+ UpdateTime = table.Column(type: "TEXT", nullable: true),
+ UpdateBy = table.Column(type: "TEXT", maxLength: 50, nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_ActionLogs", x => x.ID);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "DataPrivileges",
+ columns: table => new
+ {
+ ID = table.Column(type: "TEXT", nullable: false),
+ UserCode = table.Column(type: "TEXT", nullable: true),
+ GroupCode = table.Column(type: "TEXT", nullable: true),
+ TableName = table.Column(type: "TEXT", maxLength: 50, nullable: false),
+ RelateId = table.Column(type: "TEXT", nullable: true),
+ Domain = table.Column(type: "TEXT", nullable: true),
+ CreateTime = table.Column(type: "TEXT", nullable: true),
+ CreateBy = table.Column(type: "TEXT", maxLength: 50, nullable: true),
+ UpdateTime = table.Column(type: "TEXT", nullable: true),
+ UpdateBy = table.Column(type: "TEXT", maxLength: 50, nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_DataPrivileges", x => x.ID);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "Drivers",
+ columns: table => new
+ {
+ ID = table.Column(type: "TEXT", nullable: false),
+ DriverName = table.Column(type: "TEXT", nullable: true),
+ FileName = table.Column(type: "TEXT", nullable: true),
+ AssembleName = table.Column(type: "TEXT", nullable: true),
+ AuthorizesNum = table.Column(type: "INTEGER", nullable: false),
+ CreateTime = table.Column(type: "TEXT", nullable: true),
+ CreateBy = table.Column(type: "TEXT", maxLength: 50, nullable: true),
+ UpdateTime = table.Column(type: "TEXT", nullable: true),
+ UpdateBy = table.Column(type: "TEXT", maxLength: 50, nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Drivers", x => x.ID);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "FileAttachments",
+ columns: table => new
+ {
+ ID = table.Column(type: "TEXT", nullable: false),
+ FileName = table.Column(type: "TEXT", nullable: false),
+ FileExt = table.Column(type: "TEXT", maxLength: 10, nullable: false),
+ Path = table.Column(type: "TEXT", nullable: true),
+ Length = table.Column(type: "INTEGER", nullable: false),
+ UploadTime = table.Column(type: "TEXT", nullable: false),
+ SaveMode = table.Column(type: "TEXT", nullable: true),
+ FileData = table.Column(type: "BLOB", nullable: true),
+ ExtraInfo = table.Column(type: "TEXT", nullable: true),
+ HandlerInfo = table.Column(type: "TEXT", nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_FileAttachments", x => x.ID);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "FrameworkGroups",
+ columns: table => new
+ {
+ ID = table.Column(type: "TEXT", nullable: false),
+ GroupCode = table.Column(type: "TEXT", maxLength: 100, nullable: false),
+ GroupName = table.Column(type: "TEXT", maxLength: 50, nullable: false),
+ GroupRemark = table.Column(type: "TEXT", nullable: true),
+ TenantCode = table.Column(type: "TEXT", nullable: true),
+ CreateTime = table.Column(type: "TEXT", nullable: true),
+ CreateBy = table.Column(type: "TEXT", maxLength: 50, nullable: true),
+ UpdateTime = table.Column(type: "TEXT", nullable: true),
+ UpdateBy = table.Column(type: "TEXT", maxLength: 50, nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_FrameworkGroups", x => x.ID);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "FrameworkMenus",
+ columns: table => new
+ {
+ ID = table.Column(type: "TEXT", nullable: false),
+ PageName = table.Column(type: "TEXT", maxLength: 50, nullable: false),
+ ActionName = table.Column(type: "TEXT", nullable: true),
+ ModuleName = table.Column(type: "TEXT", nullable: true),
+ FolderOnly = table.Column(type: "INTEGER", nullable: false),
+ IsInherit = table.Column(type: "INTEGER", nullable: false),
+ ClassName = table.Column(type: "TEXT", nullable: true),
+ MethodName = table.Column(type: "TEXT", nullable: true),
+ Domain = table.Column(type: "TEXT", nullable: true),
+ ShowOnMenu = table.Column(type: "INTEGER", nullable: false),
+ IsPublic = table.Column(type: "INTEGER", nullable: false),
+ DisplayOrder = table.Column(type: "INTEGER", nullable: false),
+ IsInside = table.Column(type: "INTEGER", nullable: false),
+ Url = table.Column(type: "TEXT", nullable: true),
+ Icon = table.Column(type: "TEXT", maxLength: 50, nullable: true),
+ ParentId = table.Column(type: "TEXT", nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_FrameworkMenus", x => x.ID);
+ table.ForeignKey(
+ name: "FK_FrameworkMenus_FrameworkMenus_ParentId",
+ column: x => x.ParentId,
+ principalTable: "FrameworkMenus",
+ principalColumn: "ID",
+ onDelete: ReferentialAction.Restrict);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "FrameworkRoles",
+ columns: table => new
+ {
+ ID = table.Column(type: "TEXT", nullable: false),
+ RoleCode = table.Column(type: "TEXT", maxLength: 100, nullable: false),
+ RoleName = table.Column(type: "TEXT", maxLength: 50, nullable: false),
+ RoleRemark = table.Column(type: "TEXT", nullable: true),
+ TenantCode = table.Column(type: "TEXT", nullable: true),
+ CreateTime = table.Column(type: "TEXT", nullable: true),
+ CreateBy = table.Column(type: "TEXT", maxLength: 50, nullable: true),
+ UpdateTime = table.Column(type: "TEXT", nullable: true),
+ UpdateBy = table.Column(type: "TEXT", maxLength: 50, nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_FrameworkRoles", x => x.ID);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "FrameworkUserGroups",
+ columns: table => new
+ {
+ ID = table.Column(type: "TEXT", nullable: false),
+ UserCode = table.Column