private void HandleEvent(BookDeleteEvent domainEvent) { using (QueryDBEntities _dbContext = new QueryDBEntities()) { Book book = _dbContext.Book.FirstOrDefault(t => t.AggregateRootId == domainEvent.AggregateRootId); _dbContext.Entry(book).State = EntityState.Deleted; _dbContext.SaveChanges(); } }
public void HandleEvent(BookDeleteEvent e) { this.AggregateRootId = Guid.Empty; this.Title = null; this.Author = null; this.Description = null; this.ISBN = null; this.Pages = 0; this.Inventory = 0; }