小编Par*_*tha的帖子

无法跟踪实体类型的实例,因为已在跟踪具有相同键值的另一个实例

我从实体基类得到相同的键值运行时异常。我尝试了一些在线解决方案,但没有成功。谁能帮我解决这个问题?当我尝试更新时,以下行抛出异常:

this.RepositoryContext.Set().Update(实体);

框架:.netcore 3.1

错误:

{“无法跟踪实体类型“JobConnection”的实例,因为已跟踪具有相同 {'JobConnectionId'} 键值的另一个实例。附加现有实体时,请确保仅附加一个具有给定键值的实体实例.考虑使用“DbContextOptionsBuilder.EnableSensitiveDataLogging”来查看冲突的键值。”}。

这是调用:

public void UpdateJobConn(JobConnection jobfile)
        {
            Update(jobfile);
            Save();
        }
Run Code Online (Sandbox Code Playgroud)

这是整个 Repository 类:

using Foreside.Etp.Contracts;
using Foreside.Etp.Entities.Models;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Linq;

namespace Foreside.Etp.Repository
{
    public abstract class RepositoryBase<T> : IRepositoryBase<T> where T : class
    {
        protected EtpRepoContext RepositoryContext { get; set; }

        public RepositoryBase(EtpRepoContext repositoryContext)
        {
            this.RepositoryContext = repositoryContext;
        }

        public IEnumerable<T> FindAll()
        {
            return this.RepositoryContext.Set<T>();
        }

        public IEnumerable<T> FindByCondition(Expression<Func<T, bool>> expression)
        {
            return this.RepositoryContext.Set<T>().Where(expression);
        }

        public void Create(T …
Run Code Online (Sandbox Code Playgroud)

c# entity-framework entity-framework-core .net-core-3.1

9
推荐指数
1
解决办法
2万
查看次数

弃用错误:未安装“wheel”包

我们在尝试部署 python 代码时遇到以下弃用错误。我们使用的是 python 3.7.12。我们尝试安装wheel包作为部署的一部分,但没有成功。我们需要提及任何特定版本的轮子吗——你能放一些灯吗?

2022-11-14T19:34:39.7229174Z ##[error]Bash wrote one or more lines to the standard error stream.
2022-11-14T19:34:39.7241399Z ##[error]  DEPRECATION: wrapt is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559

2022-11-14T19:34:39.7244863Z ##[error]  DEPRECATION: keyless-fernet is being installed using the legacy 'setup.py install' method, because …
Run Code Online (Sandbox Code Playgroud)

python deprecation-warning python-wheel python-3.7

8
推荐指数
1
解决办法
4万
查看次数