Hello everyone, this is my first post on the forum.
I'm learning MVC 2 with the Wrox Visual Studio 2010 and .Net 4 (six in one) book.
I'm a bit confused when i have to use "ApplyOriginalValues".
I've detach, then a new attach and finally ApplyOriginalValues.
C# Code from the Wrox book
Code:
context.Books.ApplyOriginalValues(
new Book { Id = editedBook.Id });
The code is working. But the question is: Why a New entity needs to be created?
My
vb code is :
Code:
context.Books.Attach(editedBook)
Dim newBook As New Book
newBook .Id = editedBook.Id
context.Books.ApplyOriginalValues(newBook)
context.SaveChanges()
Thanks a lot for your help.
