还原net9

This commit is contained in:
陈益 2025-12-07 20:21:24 +08:00
parent 94af3c9a7f
commit f48c6e64eb
20 changed files with 9941 additions and 116 deletions

15
.gitignore vendored
View File

@ -58,18 +58,5 @@
/host/JiShe.IoT.HttpApi.Host/UploadFile/20250729/host/abp-file-management
/host/JiShe.IoT.HttpApi.Host/UploadFile/20250731/host/abp-file-management/3a1b7059-f930-8a33-5a5b-a67f48f2feec
/gateways/JiShe.IoT.WebGateway/bin/Debug/net10.0
/src/JiShe.IoT.Application/bin/Debug/net10.0
/src/JiShe.IoT.Application.Contracts/bin/Debug/net10.0
/src/JiShe.IoT.DbMigrator/bin/Debug/net10.0
/src/JiShe.IoT.DbMigrator/bin/Debug/net10.0/cs/Microsoft.CodeAnalysis.CSharp.resources.dll
/src/JiShe.IoT.Domain/bin/Debug/net10.0
/src/JiShe.IoT.Domain.Shared/bin/Debug/net10.0
/src/JiShe.IoT.EntityFrameworkCore/bin/Debug/net10.0
/src/JiShe.IoT.HttpApi/bin/Debug/net10.0
/src/JiShe.IoT.HttpApi.Client/bin/Debug/net10.0
/test/JiShe.IoT.Application.Tests/bin/Debug/net10.0
/test/JiShe.IoT.Domain.Tests/bin/Debug/net10.0
/test/JiShe.IoT.EntityFrameworkCore.Tests/bin/Debug/net10.0
/test/JiShe.IoT.HttpApi.Client.ConsoleTestApp/bin/Debug/net10.0
/test/JiShe.IoT.TestBase/bin/Debug/net10.0
/host/JiShe.IoT.HttpApi.Host/bin/Debug/net10.0
/src/JiShe.IoT.Application/bin/Debug/net10.0

View File

@ -19,6 +19,7 @@
<PackageReference Update="Microsoft.AspNetCore.Mvc.Core" Version="2.3.0"/>
<PackageReference Update="Microsoft.AspNetCore.Http.Abstractions" Version="2.3.0"/>
<PackageReference Update="Microsoft.AspNetCore.Http.Features" Version="2.3.0"/>
<PackageReference Update="Microsoft.CSharp" Version="4.12.0"/>
<PackageReference Update="Microsoft.CodeAnalysis.CSharp" Version="4.12.0"/>
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="17.8.0"/>

View File

@ -19,7 +19,7 @@
<PackageReference Update="Volo.Abp.BackgroundJobs.HangFire" Version="$(VoloAbpVersion)"/>
<PackageReference Update="Volo.Abp.AspNetCore.SignalR" Version="$(VoloAbpVersion)"/>
<PackageReference Update="Volo.Abp.TestBase" Version="$(VoloAbpVersion)"/>
<PackageReference Update="Volo.Abp.EntityFrameworkCore.MySQL.Pomelo" Version="$(VoloAbpVersion)"/>
<PackageReference Update="Volo.Abp.EntityFrameworkCore.MySQL" Version="$(VoloAbpVersion)"/>
<PackageReference Update="Volo.Abp.PermissionManagement.EntityFrameworkCore" Version="$(VoloAbpVersion)"/>
<PackageReference Update="Volo.Abp.SettingManagement.EntityFrameworkCore" Version="$(VoloAbpVersion)"/>
<PackageReference Update="Volo.Abp.Identity.EntityFrameworkCore" Version="$(VoloAbpVersion)"/>
@ -94,5 +94,6 @@
<PackageReference Update="Volo.Abp.EventBus" Version="$(VoloAbpVersion)"/>
<PackageReference Update="Volo.Abp.Localization" Version="$(VoloAbpVersion)" />
<PackageReference Update="Volo.Abp.DistributedLocking" Version="$(VoloAbpVersion)" />
<PackageReference Update="Volo.Abp.EntityFrameworkCore.MySQL.Pomelo" Version="$(VoloAbpVersion)" />
</ItemGroup>
</Project>

View File

@ -3,15 +3,13 @@
<PropertyGroup>
<!--JiShe.ServicePro版本-->
<ServiceProVersion>1.0.5.40</ServiceProVersion>
<!--Volo Abp 版本-->
<VoloAbpVersion>10.0.1</VoloAbpVersion>
<VoloAbpVersion>9.3.4</VoloAbpVersion>
<!--Dotnet 组件 版本-->
<DotnetInfoVersion>10.0.0</DotnetInfoVersion>
<DotnetInfoVersion>9.0.6</DotnetInfoVersion>
<!--Dotnet 框架 版本-->
<DotnetTargetFrameworkVersion>net10.0</DotnetTargetFrameworkVersion>
<DotnetTargetFrameworkVersion>net9.0</DotnetTargetFrameworkVersion>
</PropertyGroup>
</Project>

View File

@ -51,26 +51,26 @@
<PackageReference Update="Savorboard.CAP.InMemoryMessageQueue" Version="8.2.1"/>
<!-- Swagger-->
<PackageReference Update="Swashbuckle.AspNetCore.SwaggerUI" Version="10.0.1"/>
<PackageReference Update="Swashbuckle.AspNetCore" Version="10.0.1"/>
<PackageReference Update="Swashbuckle.AspNetCore.Annotations" Version="10.0.1"/>
<PackageReference Update="Swashbuckle.AspNetCore.SwaggerUI" Version="9.0.0"/>
<PackageReference Update="Swashbuckle.AspNetCore" Version="9.0.0"/>
<PackageReference Update="Swashbuckle.AspNetCore.Annotations" Version="9.0.0"/>
<!-- Serilog 日志-->
<PackageReference Update="Serilog" Version="4.3.0"/>
<PackageReference Update="Serilog.Extensions.Logging" Version="10.0.0"/>
<PackageReference Update="Serilog.Extensions.Logging" Version="9.0.2"/>
<PackageReference Update="Serilog.Sinks.Async" Version="2.1.0"/>
<PackageReference Update="Serilog.Sinks.File" Version="7.0.0"/>
<PackageReference Update="Serilog.Sinks.Console" Version="6.1.1"/>
<PackageReference Update="Serilog.AspNetCore" Version="10.0.0"/>
<PackageReference Update="Serilog.Sinks.Console" Version="6.0.0"/>
<PackageReference Update="Serilog.AspNetCore" Version="9.0.0"/>
<PackageReference Update="Serilog.Exceptions" Version="8.4.0"/>
<PackageReference Update="Serilog.Settings.Configuration" Version="10.0.0"/>
<PackageReference Update="Elastic.Serilog.Sinks" Version="9.0.0"/>
<PackageReference Update="Serilog.Settings.Configuration" Version="9.0.0"/>
<PackageReference Update="Serilog.Sinks.Elasticsearch" Version="9.0.3"/>
<!-- Magicodes 导入导出Excel-->
<PackageReference Update="Magicodes.IE.Excel" Version="2.8.0"/>
<PackageReference Update="Magicodes.IE.Excel.AspNetCore" Version="2.8.0"/>
<PackageReference Update="Magicodes.IE.Excel" Version="2.7.5.2"/>
<PackageReference Update="Magicodes.IE.Excel.AspNetCore" Version="2.7.5.2"/>
<!-- MiniProfiler 查看接口耗时,sql耗时-->
<PackageReference Update="MiniProfiler.AspNetCore.Mvc" Version="4.5.4"/>
@ -88,8 +88,8 @@
<!-- Humanizer 中文格式包-->
<PackageReference Update="Humanizer.Core.zh-Hans" Version="2.14.1"/>
<!-- elastic elasticsearch-->
<PackageReference Update="Elastic.Clients.Elasticsearch" Version="9.2.2"/>
<!-- NEST ElasticSearch-->
<PackageReference Update="NEST" Version="7.17.5"/>
<PackageReference Update="WebApiClientCore" Version="2.1.5" />
@ -102,13 +102,11 @@
<PackageReference Update="Scriban" Version="5.4.4" />
<PackageReference Update="Otp.NET" Version="1.4.0" />
<PackageReference Update="QRCoder" Version="1.7.0" />
<PackageReference Update="QRCoder" Version="1.6.0" />
<!--SixLabors.ImageSharp-->
<PackageReference Update="SixLabors.ImageSharp" Version="3.1.12" />
<!--MySql.EntityFrameworkCore-->
<PackageReference Update="MySql.EntityFrameworkCore" Version="10.0.0-rc" />
</ItemGroup>
</Project>

View File

@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 18
VisualStudioVersion = 18.0.11217.181
VisualStudioVersion = 18.0.11217.181 d18.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JiShe.IoT.Domain", "src\JiShe.IoT.Domain\JiShe.IoT.Domain.csproj", "{554AD327-6DBA-4F8F-96F8-81CE7A0C863F}"
EndProject
@ -236,6 +236,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JiShe.ServicePro.CAP.Entity
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JiShe.ServicePro.CTWingAep.Provider", "JiShe.ServicePro\frameworks\src\JiShe.ServicePro.CTWingAep.Provider\JiShe.ServicePro.CTWingAep.Provider.csproj", "{4280ED21-7498-85F9-315F-BC1CB3458900}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JiShe.ServicePro.ElasticSearch", "JiShe.ServicePro\frameworks\src\JiShe.ServicePro.ElasticSearch\JiShe.ServicePro.ElasticSearch.csproj", "{9CB012D4-9905-6623-E78D-A6649660EDB1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JiShe.ServicePro.HttpClient", "JiShe.ServicePro\frameworks\src\JiShe.ServicePro.HttpClient\JiShe.ServicePro.HttpClient.csproj", "{FCA448BF-8B4C-4932-654A-B942A3777E5C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JiShe.ServicePro.Localization", "JiShe.ServicePro\frameworks\src\JiShe.ServicePro.Localization\JiShe.ServicePro.Localization.csproj", "{08FCE8E5-2F1D-F04F-FD45-9693709C262A}"
@ -679,6 +681,10 @@ Global
{4280ED21-7498-85F9-315F-BC1CB3458900}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4280ED21-7498-85F9-315F-BC1CB3458900}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4280ED21-7498-85F9-315F-BC1CB3458900}.Release|Any CPU.Build.0 = Release|Any CPU
{9CB012D4-9905-6623-E78D-A6649660EDB1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9CB012D4-9905-6623-E78D-A6649660EDB1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9CB012D4-9905-6623-E78D-A6649660EDB1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9CB012D4-9905-6623-E78D-A6649660EDB1}.Release|Any CPU.Build.0 = Release|Any CPU
{FCA448BF-8B4C-4932-654A-B942A3777E5C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FCA448BF-8B4C-4932-654A-B942A3777E5C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FCA448BF-8B4C-4932-654A-B942A3777E5C}.Release|Any CPU.ActiveCfg = Release|Any CPU
@ -857,6 +863,7 @@ Global
{DFC637A5-87AC-1C38-37B3-4077866E8258} = {72493AF2-CDAA-40A7-98AB-B8AA2B05965E}
{2267BD37-7F07-0AF0-CA18-7CE4D2D43A71} = {72493AF2-CDAA-40A7-98AB-B8AA2B05965E}
{4280ED21-7498-85F9-315F-BC1CB3458900} = {72493AF2-CDAA-40A7-98AB-B8AA2B05965E}
{9CB012D4-9905-6623-E78D-A6649660EDB1} = {72493AF2-CDAA-40A7-98AB-B8AA2B05965E}
{FCA448BF-8B4C-4932-654A-B942A3777E5C} = {72493AF2-CDAA-40A7-98AB-B8AA2B05965E}
{08FCE8E5-2F1D-F04F-FD45-9693709C262A} = {72493AF2-CDAA-40A7-98AB-B8AA2B05965E}
{29859269-BBC5-66F7-B18F-71FDA7A4493D} = {72493AF2-CDAA-40A7-98AB-B8AA2B05965E}

View File

@ -36,7 +36,7 @@ global using Microsoft.Extensions.Logging;
global using Microsoft.Extensions.Logging.Abstractions;
global using Microsoft.Extensions.Options;
global using Microsoft.IdentityModel.Tokens;
global using Microsoft.OpenApi;
global using Microsoft.OpenApi.Models;
global using JiShe.IoT;
global using Serilog;
global using StackExchange.Redis;

View File

@ -149,12 +149,12 @@ public partial class IoTHttpApiHostModule
options =>
{
// 文件下载类型
options.MapType<FileContentResult>(() => new OpenApiSchema() { Type = JsonSchemaType.String, Format = "binary" });
options.MapType<FileContentResult>(() => new OpenApiSchema() { Type = "file" });
options.SwaggerDoc("AbpPro", new OpenApiInfo { Title = "AbpPro API", Version = "v1" });
var configuration = context.Services.GetConfiguration();
var groupNames = System.EnumExtensions.GetEnumTypeValueNameList<SwaggerGroupEnum>();
var groupNames = EnumExtensions.GetEnumTypeValueNameList<SwaggerGroupEnum>();
var excludeSwaggerGroups = configuration.GetSection("ExcludeSwaggerGroup").Get<List<string>>() ?? new List<string>();
groupNames.ForEach(group =>
@ -207,10 +207,16 @@ public partial class IoTHttpApiHostModule
Scheme = JwtBearerDefaults.AuthenticationScheme,
BearerFormat = "JWT"
});
options.AddSecurityRequirement(document => new OpenApiSecurityRequirement
options.AddSecurityRequirement(new OpenApiSecurityRequirement
{
{
new OpenApiSecuritySchemeReference(JwtBearerDefaults.AuthenticationScheme, document),
new OpenApiSecurityScheme
{
Reference = new OpenApiReference
{
Type = ReferenceType.SecurityScheme, Id = "Bearer"
}
},
new List<string>()
}
});
@ -223,11 +229,15 @@ public partial class IoTHttpApiHostModule
Description = "多语言设置系统预设语言有zh-Hans、en默认为zh-Hans",
});
options.AddSecurityRequirement(document => new OpenApiSecurityRequirement
options.AddSecurityRequirement(new OpenApiSecurityRequirement
{
{
new OpenApiSecuritySchemeReference("ApiKey", document),
new List<string>()
new OpenApiSecurityScheme
{
Reference = new OpenApiReference
{ Type = ReferenceType.SecurityScheme, Id = "ApiKey" }
},
Array.Empty<string>()
}
});
});

View File

@ -88,7 +88,7 @@ namespace JiShe.IoT
app.UseSwagger();
app.UseAbpSwaggerUI(options =>
{
var groupNames = System.EnumExtensions.GetEnumTypeValueNameList<SwaggerGroupEnum>();
var groupNames = EnumExtensions.GetEnumTypeValueNameList<SwaggerGroupEnum>();
var excludeSwaggerGroups = configuration.GetSection("ExcludeSwaggerGroup").Get<List<string>>() ?? new List<string>();
groupNames.ForEach(attr =>
{

View File

@ -29,10 +29,11 @@
<PackageReference Include="Serilog.Extensions.Logging" />
<PackageReference Include="Serilog.Settings.Configuration" />
<PackageReference Include="Serilog.Sinks.Console" />
<PackageReference Include="Elastic.Serilog.Sinks" />
<PackageReference Include="Serilog.Sinks.Elasticsearch" />
<PackageReference Include="Serilog.Sinks.File" />
<PackageReference Include="Serilog.Sinks.Async" />
<PackageReference Include="Hangfire.Redis.StackExchange" />
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" />
<PackageReference Include="MiniProfiler.AspNetCore.Mvc" />
<PackageReference Include="DotNetCore.CAP.MySql" />
<PackageReference Include="DotNetCore.CAP.RabbitMQ" />

View File

@ -4,19 +4,19 @@
"CorsOrigins": "https://*.IoT.com,http://localhost:4200,http://localhost:3100,http://localhost:80,http://10.10.90.3:4200"
},
"ConnectionStrings": {
"Default": "Data Source=192.168.111.174;Port=13306;Database=JiSheIoTProDB;uid=root;pwd=JiShe!aqG#5kGgh&0;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true;TreatTinyAsBoolean=false;SslMode=None;Pooling=true;"
"Default": "Data Source=localhost;Port=33306;Database=JiSheIoTProDB54;uid=root;pwd=123456789;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true;TreatTinyAsBoolean=false;SslMode=None;Pooling=true;"
},
"Hangfire": {
"Redis": {
"Host": "192.168.111.174:30712,password=1q3J@BGf!yhTaD46nS#",
"Host": "47.110.53.196:30712,password=1q3J@BGf!yhTaD46nS#",
"DB": "2"
}
},
"Redis": {
"Configuration": "192.168.111.174:30712,password=1q3J@BGf!yhTaD46nS#,defaultdatabase=5"
"Configuration": "47.110.53.196:30712,password=1q3J@BGf!yhTaD46nS#,defaultdatabase=5"
},
"Kafka": {
"BootstrapServers": "47.110.62.104:9094,192.168.111.174:9094,47.110.60.222:9094",
"BootstrapServers": "47.110.62.104:9094,47.110.53.196:9094,47.110.60.222:9094",
"EnableFilter": true,
"EnableAuthorization": false,
"SaslUserName": "lixiao",
@ -26,8 +26,8 @@
"TaskThreadCount": -1
},
"Pulsar": {
"ServiceUrl": "pulsar+ssl://iot-north-mq.heclouds.com:6651", //pulsar+ssl://iot-north-mq.heclouds.com:6651 pulsar://192.168.111.174:26974
"WebUrl": "http://192.168.111.174:9094",
"ServiceUrl": "pulsar+ssl://iot-north-mq.heclouds.com:6651", //pulsar+ssl://iot-north-mq.heclouds.com:6651 pulsar://47.110.53.196:26974
"WebUrl": "http://47.110.53.196:9094",
"UserName": "admin",
"TenantName": "1YMVZZkAkRArjxSD8457",
"Namespace": "OneNET",
@ -57,10 +57,10 @@
"IoTDBOptions": {
"UserName": "root",
"Password": "Lixiao@1980",
//"TreeModelClusterList": [ "192.168.111.174:6667", "47.110.60.222:6667", "47.110.62.104:6667" ],
//"TableModelClusterList": [ "192.168.111.174:6667", "47.110.60.222:6667", "47.110.62.104:6667" ],
"TreeModelClusterList": [ "192.168.111.174:30710" ],
"TableModelClusterList": [ "192.168.111.174:30710" ],
//"TreeModelClusterList": [ "47.110.53.196:6667", "47.110.60.222:6667", "47.110.62.104:6667" ],
//"TableModelClusterList": [ "47.110.53.196:6667", "47.110.60.222:6667", "47.110.62.104:6667" ],
"TreeModelClusterList": [ "47.110.53.196:30710" ],
"TableModelClusterList": [ "47.110.53.196:30710" ],
"PoolSize": 32,
"DataBaseName": "jisheiotdata",
"OpenDebugMode": true,
@ -97,7 +97,7 @@
}
},
"FreeRedisOptions": {
"ConnectionString": "192.168.111.174:30712,password=1q3J@BGf!yhTaD46nS#,abortConnect=false,connectTimeout=30000,allowAdmin=true,maxPoolSize=500,defaultdatabase=14",
"ConnectionString": "47.110.53.196:30712,password=1q3J@BGf!yhTaD46nS#,abortConnect=false,connectTimeout=30000,allowAdmin=true,maxPoolSize=500,defaultdatabase=14",
"UseDistributedCache": true
},
"FreeSqlProviderOptions": {

View File

@ -1,6 +1,6 @@
{
"ConnectionStrings": {
"Default": "Data Source=localhost;Port=33306;Database=JiSheIoTProDB3;uid=root;pwd=123456789;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true;TreatTinyAsBoolean=false;SslMode=Preferred;Pooling=true;"
"Default": "Data Source=localhost;Port=33306;Database=JiSheIoTProDB54;uid=root;pwd=123456789;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true;TreatTinyAsBoolean=false;SslMode=None;Pooling=true;"
},
"IoTDBOptions": {
"UserName": "root",

View File

@ -50,6 +50,8 @@ namespace JiShe.IoT.EntityFrameworkCore
public DbSet<TenantConnectionString> TenantConnectionStrings { get; set; }
public DbSet<BackgroundJobRecord> BackgroundJobs { get; set; }
public DbSet<AuditLog> AuditLogs { get; set; }
public DbSet<AuditLogExcelFile> AuditLogExcelFiles { get; set; }
public DbSet<Notification> Notifications { get; set; }
public DbSet<NotificationSubscription> NotificationSubscriptions { get; set; }
public DbSet<DataDictionary> DataDictionaries { get; set; }
@ -86,7 +88,7 @@ namespace JiShe.IoT.EntityFrameworkCore
public DbSet<OneNETAccountInfos> OneNETAccountInfo { get; set; }
public DbSet<OneNETProductInfos> OneNETProductInfo { get; set; }
public DbSet<AuditLogExcelFile> AuditLogExcelFiles { get; set; }
public IoTDbContext(DbContextOptions<IoTDbContext> options)
: base(options)

View File

@ -4,7 +4,6 @@ using JiShe.ServicePro.DynamicMenuManagement.EntityFrameworkCore;
using JiShe.ServicePro.FileManagement.EntityFrameworkCore;
using JiShe.ServicePro.OneNETManagement.EntityFrameworkCore;
using JiShe.ServicePro.TemplateManagement.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore.MySQL;
using Volo.Abp.Guids;
namespace JiShe.IoT.EntityFrameworkCore
@ -38,10 +37,6 @@ namespace JiShe.IoT.EntityFrameworkCore
* default repositories only for aggregate roots */
options.AddDefaultRepositories(includeAllEntities: true);
});
//// 注册自定义的IdentityUserRepository以修复ABP 10.0.1与MySQL的兼容性问题
//context.Services.AddTransient<Volo.Abp.Identity.IIdentityUserRepository, IoTIdentityUserRepository>();
Configure<AbpSequentialGuidGeneratorOptions>(options =>
{
options.DefaultSequentialGuidType = SequentialGuidType.SequentialAsString;

View File

@ -1,38 +0,0 @@
using Microsoft.EntityFrameworkCore;
using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.Identity;
namespace JiShe.IoT.EntityFrameworkCore
{
/// <summary>
/// 自定义IdentityUserRepository修复ABP 10.0.1与MySQL提供程序的兼容性问题
/// 解决 "Expression '@organizationUnitIds' in the SQL tree does not have a type mapping assigned" 错误
/// </summary>
public class IoTIdentityUserRepository : Volo.Abp.Identity.EntityFrameworkCore.EfCoreIdentityUserRepository
{
public IoTIdentityUserRepository(
IDbContextProvider<IoTDbContext> dbContextProvider)
: base((IDbContextProvider<Volo.Abp.Identity.EntityFrameworkCore.IIdentityDbContext>)dbContextProvider)
{
}
public override async Task<List<string>> GetRoleNamesAsync(Guid id, CancellationToken cancellationToken = default)
{
var dbContext = await GetDbContextAsync();
// 使用Join查询来避免参数化集合查询的问题
// 这样可以避免EF Core将集合参数转换为SQL参数时出现的类型映射问题
var roleNames = await (from user in dbContext.Users
join userRole in dbContext.Set<IdentityUserRole>() on user.Id equals userRole.UserId
join role in dbContext.Roles on userRole.RoleId equals role.Id
where user.Id == id
select role.Name)
.Distinct()
.ToListAsync(GetCancellationToken(cancellationToken));
return roleNames ?? new List<string>();
}
}
}

View File

@ -1,3 +1,5 @@
using Microsoft.EntityFrameworkCore;
namespace JiShe.IoT.EntityFrameworkCore
{
/* This class is needed for EF Core console commands
@ -10,9 +12,8 @@ namespace JiShe.IoT.EntityFrameworkCore
var configuration = BuildConfiguration();
var serverVersion = new MySqlServerVersion(new Version(8, 4, 6));
var builder = new DbContextOptionsBuilder<IoTDbContext>()
.UseMySql(configuration.GetConnectionString("Default"), serverVersion);
.UseMySql(configuration.GetConnectionString("Default") , serverVersion);
return new IoTDbContext(builder.Options);
}

View File

@ -3,15 +3,10 @@
<TargetFramework>$(DotnetTargetFrameworkVersion)</TargetFramework>
<RootNamespace>JiShe.IoT</RootNamespace>
</PropertyGroup>
<ItemGroup>
<Compile Remove="EntityFrameworkCore\IoTIdentityUserRepository.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\JiShe.IoT.Domain\JiShe.IoT.Domain.csproj" />
<PackageReference Include="Volo.Abp.EntityFrameworkCore.MySQL.Pomelo" />
<!--<PackageReference Include="MySql.EntityFrameworkCore" />-->
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="9.0.0" />
</ItemGroup>
<ItemGroup Condition=" '$(Configuration)' == 'Debug'" Label="Debug">

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff