Plain and simple, is there any difference between
DbSet().Remove(x)
to
context.Entry(x).State = State.Deleted?
Thanks
Plain and simple, is there any difference between
DbSet().Remove(x)
to
context.Entry(x).State = State.Deleted?
Thanks
Not that I can tell, the MSDN article for Remove says
Marks the given entity as Deleted such that it will be deleted from the database when SaveChanges is called. Note that the entity must exist in the context in some other state before this method is called.
.Remove is likely just the preferred way to remove items.
EDIT:
Also, the MSDN article for the EntityState says this for deleted.
The entity is being tracked by the context and exists in the database, but has been marked for deletion from the database the next time SaveChanges is called.
Which just further solidifies that they are effectively the same thing.