You will add necessary code to the Main()
method in the Program
class to delete the Order
with the Id
field as Orders/B279855
from the Orders
database:
Add the following code snippet to the
Main()
method:Save all the files, build and run the solution.
Switch to your Management Studio, and click on the Documents tab to display documents of the
Orders
database, and check that the document is no longer in theOrders
database.
You just wrote the necessary code to update the Order
with the Id
field as Orders/B279855
and save the changes to the Orders
database.
You begin by opening a RavenDB session (line 59 in the previous code snippet). Then, you load the Order
with the Id
as Orders/B279855
by calling the Load()
method (line 61). Then, you call the Delete()
method on the Session
object and pass to it the Order ID you want to delete (line 62).
Then, you invoke the SaveChanges()
method on the session
object to delete the Order document permanently...