Not Found SqlSugar.MySqlConnector.dll 返回

SqlSugar 老数据
5 1469
该叫什么 Aiol 发布于2023/2/8
悬赏:5 飞吻

背景:

项目引入了SqlSugar 和 SqlSugar.MySqlConnector()包


nuget 包:SqlSugar

版本:5.1.3.50


C# Code 报错语句:

   SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()

                {

                    DbType = DbType.MySqlConnector,

                    ConnectionString = GetConnectionString(),

                    InitKeyType = InitKeyType.Attribute,

                    IsAutoCloseConnection = true,

                    AopEvents = new AopEvents

                    {

                        OnLogExecuting = (sql, p) =>

                        {

                            Console.WriteLine(sql);

                            Console.WriteLine(string.Join(",", p?.Select(it => it.ParameterName + ":" + it.Value)));

                        }

                    }

                });

异常信息:

message: Not Found SqlSugar.MySqlConnector.dll

位置:

   在 SqlSugar.Check.Exception(Boolean isException, String message, String[] args)

   在 SqlSugar.InstanceFactory.<>c.<GetCustomTypeByClass>b__53_0()

   在 SqlSugar.ReflectionInoCore`1.GetOrCreate(String cacheKey, Func`1 create)

   在 SqlSugar.ReflectionInoCacheService.GetOrCreate[V](String cacheKey, Func`1 create, Int32 cacheDurationInSeconds)

   在 SqlSugar.InstanceFactory.GetCustomTypeByClass(String className)

   在 SqlSugar.InstanceFactory.NoCacheGetCacheInstance[T](String className)

   在 SqlSugar.InstanceFactory.CreateInstance[T](String className)

   在 SqlSugar.InstanceFactory.GetAdo(ConnectionConfig currentConnectionConfig)

   在 SqlSugar.SqlSugarProvider.get_Ado()

   在 SqlSugar.SqlSugarClient.InitContext(ConnectionConfig config)

   在 SqlSugar.SqlSugarClient..ctor(ConnectionConfig config)



   


热忱回答(5)

  • -

    0 回复
  • SqlSugar.MySqlConnector要NUGET安装,如果还有疑问 ,提供控制台DEMO

    0 回复
  • xiaodong xiaodong VIP0
    2025/7/16

    @fate sta:就是通过nuget安装的,还是找不到。

    0 回复
  • fate sta fate sta VIP0
    2025/7/16
    InstanceFactory.CustomAssemblies = new System.Reflection.Assembly[] {
     typeofSqlSugar.MySqlConnector.MySqlProvider).Assembly };

    程序启动时加上这个

    0 回复
  • fate sta fate sta VIP0
    2025/7/16

    @xiaodong:

    0 回复