SqlSugarCore不支持.NetCore3.1吗? 返回

SqlSugar 老数据
1 1375

protected SqlSugarClient GetDbContext(string connectionString)

        {

            try

            {

                var dbContext = new SqlSugarClient(new ConnectionConfig()

                {

                    ConnectionString = connectionString,

                    DbType = DbType.SqlServer,

                    InitKeyType = InitKeyType.Attribute,

                    IsAutoCloseConnection = true

                });


                Console.WriteLine($"[BaseSugarRepository] ConnectionString:{connectionString}");


                dbContext.Aop.OnLogExecuting = (sql, pars) =>

                {

                    Console.WriteLine("[BaseSugarRepository] " + sql + "\r\n" + dbContext.Utilities.SerializeObject(pars.ToDictionary(it => it.ParameterName, it => it.Value)));

                };


                return dbContext;

            }

            catch (Exception ex)

            {

                Console.WriteLine($"[BaseSugarRepository Exception] Message:{ex.Message}, StackTrace:{ex.StackTrace}");

                throw new Exception("Failed to connect database. Please check the connection string and network connection", ex);

            }

        }


==============================================================


        public async Task<ConfigEntity> GetConfiguration()

        {

            using (var dbContext = GetDbContext(_connectionStrings.SqlServerConnection))

            {


                return await dbContext.Queryable<ConfigEntity>().With(SqlWith.NoLock)

                    .Where(c => c.Type == (int) EnumConfigType.Special).OrderBy(o => o.Id, OrderByType.Desc)

                    .FirstAsync();

            }

        }


GetConfiguration()一直不返回数据

热忱回答1