title: How can I correlate events in a masstransit state machine without using a Guid?
body: <p>I have defined the following state machine in Masstransit:</p>
  
  <pre><code>public class OrderStateMachine : MassTransitStateMachine&lt;OrderState&gt;
  {
      public OrderStateMachine()
      {
          InstanceState(x =&gt; x.Status);
  
          Event(() =&gt; OrderCreated, x =&gt; x.CorrelateBy(order =&gt; order.OrderCode, ctx =&gt; ctx.Message.OrderCode).SelectId(ctx =&gt; NewId.NextGuid()));
  
          //How should I select an id for these events?
          Event(() =&gt; OrderProvisioned, x =&gt; x.CorrelateBy(order =&gt; order.OrderCode, ctx =&gt; ctx.Message.OrderCode));
          Event(() =&gt; OrderInvoiced, x =&gt; x.CorrelateBy(order =&gt; order.OrderCode, ctx =&gt; ctx.Message.OrderCode));
  
          State(() =&gt; Created);
          State(() =&gt; Finished);
  
          CompositeEvent(() =&gt; OrderFinished, order =&gt; order.CompositeStatus, OrderProvisioned, OrderInvoiced);
  
          Initially(
              When(OrderCreated)
                  .Then(context =&gt; Console.WriteLine("Order created"))
                  .TransitionTo(Created));
  
          During(Created,
              When(OrderFinished)
                  .Then(context =&gt; Console.WriteLine("Order finished"))
                  .TransitionTo(Finished)
                  .Finalize());
  
      }
  
      public State Created { get; set; }
      public State Finished { get; set; }
  
      public Event&lt;OrderCreated&gt; OrderCreated { get; set; }
      public Event&lt;OrderProvisioned&gt; OrderProvisioned { get; set; }
      public Event&lt;OrderInvoiced&gt; OrderInvoiced { get; set; }
      public Event OrderFinished { get; set; }
  
  }
  
  public class OrderState : SagaStateMachineInstance
  {
      public Guid CorrelationId { get; set; }
  
      public string OrderCode { get; set; }
      public string Status { get; set; }
      public CompositeEventStatus CompositeStatus { get; set; }
  
  }
  
  public class OrderCreated
  {
      public string OrderCode { get; set; }
  
      public OrderCreated(string orderCode)
      {
          OrderCode = orderCode;
      }
  }
  
  public class OrderInvoiced
  {
      public string OrderCode { get; set; }
  
      public OrderInvoiced(string orderCode)
      {
          OrderCode = orderCode;
      }
  
  }
  
  public class OrderProvisioned
  {
      public string OrderCode { get; set; }
  
      public OrderProvisioned(string orderCode)
      {
          OrderCode = orderCode;
      }
  }
  </code></pre>
  
  <p>How can I correlate the OrderProvisoned and the OrderInvoiced event to the same OrderState instance as the initial OrderCreated event without sending Guids in my events and only use the ordercode property to correlate them?
  If I run this example, I never get the OrderFinished event if both OrderProvisioned and OrderInvoiced are sent, but if I add Guids to the events and correlate them based on that Guid it is executed correctly.</p>