내가 할 수 있는지 보자 단계별로 명확 : InventoryRepository
에 정의 된 Remove
방법을 실행Remove 메서드는 DB에서 항목을 제거하지 않습니다.
namespace InventoryManager.Controllers
{
public class InventoryController : ApiController
{
private readonly IInventoryRepository repository;
//...
public HttpResponseMessage DeleteItem(int id)
{
// Executes fine
repository.Remove(id);
return new HttpResponseMessage(HttpStatusCode.NoContent);
}
}
}
가 :
namespace InventoryManager.Models
{
public class InventoryRepository : IInventoryRepository
{
private InventoryContext context;
//...
public void Remove(int id)
{
InventoryItem item = context.Items.Find(id);
// Executes fine
context.Items.Remove(item);
}
}
}
는하지만, 내 DB를 확인하고 어떤 항목 제거됩니다. 왜 이런거야? 누락 된 정보가있을 수 있으니 다른 정보가 필요하면 알려주십시오.
내 요소가 없어서 디버깅하는 데 문제가 있습니다. 디버깅 방법이나 특정 문제/키워드를 찾으면 내 문제를 해결할 수 있습니다. 감사 할 것입니다.
*** 변경 사항을 확인 하시겠습니까? – xandercoded
오류가 발생하여 변경 사항을 적용하고 있습니까? 어떻게 그렇게? – Josh
Linq to SQL 또는 Entity 프레임 워크를 사용하고 있습니까? – Habib