简体   繁体   English

“Microsoft.EntityFrameworkCore.ServerVersion”中的“字符串”

[英]"string" in "Microsoft.EntityFrameworkCore.ServerVersion"

Can someone help me I have updated all my nuget packages and now I get the following error: Severity Code Description Project File Line Suppression state Error CS1503 Argument '2': Unable to convert 'string' to 'Microsoft.EntityFrameworkCore.ServerVersion'.有人可以帮我我已经更新了我所有的 nuget 包,现在我收到以下错误:严重代码描述项目文件行抑制状态错误 CS1503 参数“2”:无法将“字符串”转换为“Microsoft.EntityFrameworkCore.ServerVersion”。 Altv-Roleplay D:\Tookies-Development-main\altV Script-X\Altv-Roleplay\Altv-Roleplay\models\gtaContext.cs 101 Active Altv-Roleplay D:\Tookies-Development-main\altV Script-X\Altv-Roleplay\Altv-Roleplay\models\gtaContext.cs 101 激活


using AltV.Net.Data;
using AltV.Net;
using Altv_Roleplay.Utils;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using System.Numerics;

----------------------------------------------------------------------------------



protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            if (!optionsBuilder.IsConfigured)
            {
                //Local
                optionsBuilder.UseMySql($"server={Constants.DatabaseConfig.Host};port={Constants.DatabaseConfig.Port};user={Constants.DatabaseConfig.User};password={Constants.DatabaseConfig.Password};database={Constants .DatabaseConfig.Database}");
                optionsBuilder.EnableSensitiveDataLogging();
            }
        }

I am using Pomelo.EntityFrameworkCore.MySql 6.0.0 and faced the same issue.我正在使用 Pomelo.EntityFrameworkCore.MySql 6.0.0 并面临同样的问题。 You just need to pass the server version and mySqlOptionsAction (nullable) as below您只需要传递服务器版本和 mySqlOptionsAction(可为空),如下所示

optionsBuilder.UseMySql("your connectionstring" , ServerVersion.AutoDetect(your connectionstring), null);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法从“字符串”转换为“Microsoft.EntityFrameworkCore.ServerVersion” - Cannot convert from 'string' to 'Microsoft.EntityFrameworkCore.ServerVersion 参数 1:无法从“Microsoft.EntityFrameworkCore.DbContextOptions”转换为“字符串” - Argument 1: cannot convert from 'Microsoft.EntityFrameworkCore.DbContextOptions' to 'string' Microsoft.EntityFrameworkCore.DbUpdateConcurrencyException - Microsoft.EntityFrameworkCore.DbUpdateConcurrencyException 为什么我的字符串值返回为 Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryable`1[System.String] - Why my string value return as Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryable`1[System.String] 命名空间“Microsoft”中不存在“EntityFrameworkCore” - 'EntityFrameworkCore' does not exist in the namespace 'Microsoft' Microsoft.EntityFrameworkCore 中 ExecuteScalar 的对应项 - Counterpart of ExecuteScalar in Microsoft.EntityFrameworkCore 未安装 Microsoft.EntityFrameworkCore.Design - Microsoft.EntityFrameworkCore.Design is not installed EntityFrameworkCore 在命名空间 Microsoft 中不存在 - EntityFrameworkCore does not exist in the namespace Microsoft 找不到方法:'System.Object Microsoft.EntityFrameworkCore.Infrastructure.IAnnotatable.get_Item(System.String)' - Method not found: 'System.Object Microsoft.EntityFrameworkCore.Infrastructure.IAnnotatable.get_Item(System.String)' 实体类型&#39;Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserLogin <string> &#39;需要定义一个密钥 - The entity type 'Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserLogin<string>' requires a key to be defined
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM