title: Event sourcing - should we save to event store only changes in values of object or all object?
body: <p>I am trying to understand event sourcing with cqrs. As I understand - command handler saves changes to relational database and throws event which should be save in nosql database. I have Notes class (that is my table in database):</p>
  
  <pre><code>public partial class Notes
  {
      public System.Guid Id { get; set; }
      public string Title { get; set; }
      public string Content { get; set; }
      public System.DateTime CreatedDate { get; set; }
      public System.DateTime ModifiedDate { get; set; }
  }
  </code></pre>
  
  <p>If somebody modify only Title of a single note then I should create event with properties: Id and Title or maybe with all properties of class Notes? Because now I create event with all properties - I don't check which property has changed:</p>
  
  <pre><code>public abstract class DomainEvent
  {
      public Guid Id { get; set; }
      public DateTime CreatedDateEvent { get; set; }
  }
  
  // my event:
  public class NoteChangedEvent : DomainEvent
  {
      public string Title { get; set; }
      public string Content { get; set; }
      public DateTime ModifiedDate { get; set; }
  }
  
  // my command handler class:
  public class EditNoteCommandHandler : ICommandHandler&lt;EditNoteCommand&gt;
  {
      private readonly DbContext _context;
      private readonly IEventDispatcher _eventDispatcher;
  
      public EditNoteCommandHandler(DbContext context, IEventDispatcher eventDispatcher)
      {
          _context = context;
          _eventDispatcher = eventDispatcher;
      }
  
      public void Execute(EditNoteCommand command)
      {
          Notes note = _context.Notes.Find(command.Id);
          note.Title = command.Title;
          note.Content = command.Content;
          note.ModifiedDate = DateTime.Now;
  
          _context.SaveChanges(); // save to relational database
  
          // throw event:
          NoteChangedEvent noteChangedEvent = new NoteChangedEvent
          {
              Id = note.Id,
              Title = note.Title,
              Content = note.Content,
              ModifiedDate = note.ModifiedDate,
              CreatedDateEvent = DateTime.Now
          };
  
          _eventDispatcher.Dispatch(noteChangedEvent);
      }
  }
  
  // my dispatcher class:
  public class EventDispatcher : IEventDispatcher
  {
      public void Dispatch&lt;TEvent&gt;(TEvent @event) where TEvent : DomainEvent
      {
          foreach (IEventHandler&lt;TEvent&gt; handler in DependencyResolver.Current.GetServices&lt;IEventHandler&lt;TEvent&gt;&gt;())
          {
              handler.Handle(@event);
          }
      }
  }
  </code></pre>
  
  <p>Am I doing that correct and understand that correct or not?</p>