This commit is contained in:
ChenYi 2025-05-27 14:39:23 +08:00
parent 86da3f9799
commit 1cdd4d2e7c
4 changed files with 65 additions and 10 deletions

View File

@ -4,10 +4,36 @@
"CorsOrigins": "https://*.IoT.com,http://localhost:4200,http://localhost:3100,http://localhost:80,http://localhost" "CorsOrigins": "https://*.IoT.com,http://localhost:4200,http://localhost:3100,http://localhost:80,http://localhost"
}, },
"ConnectionStrings": { "ConnectionStrings": {
"Default": "Data Source=localhost;Port=3306;Database=JiSheIoTDB;uid=root;pwd=1q2w3E*;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true" "Default": "Data Source=localhost;Port=3306;Database=JiSheIoTProDB;uid=root;pwd=admin123;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true"
},
"Hangfire": {
"Redis": {
"Host": "192.168.5.9:6380,password=1q2w3e!@#",
"DB": "2"
}
}, },
"Redis": { "Redis": {
"Configuration": "localhost,password=1q2w3E*,defaultdatabase=1" "Configuration": "192.168.5.9:6380,password=1q2w3e!@#,defaultdatabase=5"
},
"Kafka": {
"BootstrapServers": "192.168.5.9:29092,192.168.5.9:39092,192.168.5.9:49092",
"EnableFilter": true,
"EnableAuthorization": false,
"SaslUserName": "lixiao",
"SaslPassword": "lixiao1980",
"KafkaReplicationFactor": 3,
"NumPartitions": 30,
"TaskThreadCount": -1,
"FirstCollectionTime": "2025-04-22 16:07:00"
},
"IoTDBOptions": {
"UserName": "root",
"Password": "root",
"ClusterList": [ "121.42.175.177:16667" ],
"PoolSize": 32,
"DataBaseName": "energy",
"OpenDebugMode": true,
"UseTableSessionPoolByDefault": false
}, },
"Jwt": { "Jwt": {
"Audience": "JiShe.IoT", "Audience": "JiShe.IoT",
@ -22,11 +48,5 @@
"Password": "1q2w3E*", "Password": "1q2w3E*",
"Port": 5672 "Port": 5672
} }
},
"Hangfire": {
"Redis": {
"Host": "localhost,password=1q2w3E*",
"DB": "2"
}
} }
} }

View File

@ -4,7 +4,7 @@
"CorsOrigins": "https://*.IoT.com,http://localhost:4200,http://localhost:3100,http://localhost:80,http://localhost" "CorsOrigins": "https://*.IoT.com,http://localhost:4200,http://localhost:3100,http://localhost:80,http://localhost"
}, },
"ConnectionStrings": { "ConnectionStrings": {
"Default": "Data Source=localhost;Port=3306;Database=JiSheIoTDB;uid=root;pwd=IFKy!Cufe3V9sYcz;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true" "Default": "Data Source=localhost;Port=3306;Database=JiSheIoTProDB;uid=root;pwd=IFKy!Cufe3V9sYcz;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true"
}, },
"Redis": { "Redis": {
"Configuration": "localhost,password=1q2w3E*,defaultdatabase=1" "Configuration": "localhost,password=1q2w3E*,defaultdatabase=1"

View File

@ -0,0 +1,35 @@
# 多数据库链接
> 创建数据库 命令:EntityFrameworkCore\Add-Migration InitialCreate(自定义命名,命名规范,知道每次做的什么操作)
> 更新数据库 命令:EntityFrameworkCore\Update-Database
# 多数据库连接时
> 创建数据库 命令:EntityFrameworkCore\Add-Migration -Context YMDeviceDbContext(自定义命名,命名规范,知道每次做的什么操作)
> 更新数据库 命令:EntityFrameworkCore\Update-Database -Context YMDeviceDbContext
# 迁移高级指令
> 创建迁移migrationname为迁移名称
> dotnet ef migrations add InitialCreate 移除迁移(删除最近的一次迁移)
> dotnet ef migrations remove remove-migration 应用所有的迁移(使迁移文件应用到数据库)
> dotnet ef database update 指定版本进行迁移
> dotnet ef database update migrationName 生成对应版本的脚本
> dotnet ef migrations script Script-Migration 查看迁移列表
> dotnet ef migrations list 查看数据库上下文信息 dotnet ef dbcontext info
# 更新dotnet tools
> dotnet tool update --global dotnet-ef
> 这个项目不能删除,初始化最基础的证书,以及《项目管理》的连接字符串加密都需要这个处理
> 生成SQL语句 Script-Migration -From 20220307064411_handlerMealPackage202203071443 -To 20220311084146_alterDevice202203111636 -Context ConsumerSystemDbContext
> Add-Migration alterAuditLogs202107011013 -c ConsumerSystemDbContext
> dotnet ef migrations add alterDevice202007190939 -c ConsumerSystemDbContext -s ../AIVE.ConsumerSystem.Apis
> dotnet ef database update -c ConsumerSystemDbContext
> dotnet ef migrations script 20210706022200_alterDevice202107061021 20210714013952_alterDevice202007140939 -o ./outupdate.sql -c ConsumerSystemDbContext -s ../AIVE.ConsumerSystem.Apis

View File

@ -1,5 +1,5 @@
{ {
"ConnectionStrings": { "ConnectionStrings": {
"Default": "Data Source=localhost;Port=3306;Database=JiSheIoTDB;uid=root;pwd=1q2w3E*;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true" "Default": "Data Source=localhost;Port=3306;Database=JiSheServiceProDB;uid=root;pwd=admin123;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true"
} }
} }