CQRSMicroservices.ServiceFabric.AggregateRootActor.AggregateRootActor.ExecuteOnNew C# (CSharp) Method

ExecuteOnNew() public method

public ExecuteOnNew ( string aggregateRootType, string command ) : System.Threading.Tasks.Task
aggregateRootType string
command string
return System.Threading.Tasks.Task
    public async Task ExecuteOnNew(string aggregateRootType, string command)
    {
      if(_aggregateRoot != null)
      {
        throw new Exception($"AggregateRoot with id {Id} already exists.");
      }

      var aggregateRoot = LoadAggregateRoot(aggregateRootType);
      aggregateRoot.Handle(Deserialize(command));
      await SaveAndDispatchEvents(aggregateRoot);
    }