新文章 网摘 文章 随笔 日记

The instance of entity type 'Item' cannot be tracked because another instance with the same key value for {'Id'} is already being tracked

//

services.AddEntityFrameworkSqlServer().AddDbContext<OcelotConfigDbContext>(ServiceLifetime.Singleton);
//更改为 services.AddDbContext<OcelotConfigDbContext>(c => c.UseSqlServer(Guid.NewGuid().ToString()) .UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking));

 

即可

posted @ 2020-03-12 15:19  岭南春  阅读(226)  评论(0)    收藏  举报