public void can_update_and_delete_related_documents_synchronous() { var emp1 = new CoffeeShopEmployee(); var doc1 = new CoffeeShop(); doc1.Employees.Add(emp1.Id); using (var session = theStore.OpenSession()) { session.Store(emp1); session.Store(doc1); session.SaveChanges(); } using (var session = theStore.OpenSession(tracking: DocumentTracking.DirtyTracking)) { var emp = session.Load <CoffeeShopEmployee>(emp1.Id); var doc = session.Load <CoffeeShop>(doc1.Id); doc.Employees.Remove(emp.Id); session.Delete(emp); session.SaveChanges(); } }
public async Task can_update_and_delete_related_documents() { var emp1 = new CoffeeShopEmployee(); var doc1 = new CoffeeShop(); doc1.Employees.Add(emp1.Id); using (var session = theStore.OpenSession()) { session.Store(emp1); session.Store(doc1); await session.SaveChangesAsync().ConfigureAwait(false); } using (var session = theStore.OpenSession(tracking: DocumentTracking.DirtyTracking)) { var emp = session.Load <CoffeeShopEmployee>(emp1.Id); var doc = session.Load <CoffeeShop>(doc1.Id); doc.Employees.Remove(emp.Id); session.Delete(emp); await session.SaveChangesAsync().ConfigureAwait(false); } }