문제

I have a list of OrderDetail records that I have added, updated and deleted items from. I need to be able to pass this entity object to another layer for saving changes.

How can I do this? Do I need to detach the list from it's current Context before passing it to the next layer? Then Attach it to that layer's Context?

What is the best way to do this?

도움이 되었습니까?

해결책

In the layer the object is passed into, you would indicate that the object is modified

 context.Entry(YourOrderDetailObject).State = EntityState.Modified;
 context.SaveChanges();
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top