سلام خسته نباشید...
هنگام آپدیت کردن یک عضو با این ارور مواجه میشوم:
Additional information: Attaching an entity of type 'DataLayer.WorkShop' failed because another entity of the same type already has the same primary key value. This can happen when using the 'Attach' method or setting the state of an entity to 'Unchanged' or 'Modified' if any entities in the graph have conflicting key values. This may be because some entities are new and have not yet received database-generated key values. In this case use the 'Add' method or the 'Added' entity state to track the graph and then set the state of non-new entities to 'Unchanged' or 'Modified' as appropriate.
متن ارور داره میگه
failed because another entity of the same type already has the same primary key value
اینطور مواقع متن را در گوگل قرار دهید راه حل موجوده
آخه کلید اصلیش آیدیش هست که توی حذف کردن درست جواب میده اما توی اپیدیت نمیدونم چه اشکالی پیش میاد که میگه قبلا وجود داشته.. آیدی درست فراخوانی میشه چون اطلاعات همون شخص مورد نظر روی تکست باکس ها چاپ میشه اما هنگام انجام عمل ویرایش روی متد
_db.Entry(entity).State = EntityState.Modified;
ارور مذکور ظاهر میشه
چون رکوردی که دارید ویرایش میکنید توسط کوئری دیگه درحال استفاده است
متن خطا رو سرچ کنید
باید detached بشه
درست شد دستتون درد نکنه
سپاس