Beispiel #1
0
 IGangCommandExecutor <TStateData> IGangCommandExecutor <TStateData>
 .RegisterHandler <TCommandData>(GangCommandHandler <TStateData> handler)
 {
     return(new GangCommandExecutor <TStateData>(
                _serialization,
                _handlers.Values.Append(handler)
                ));
 }
Beispiel #2
0
 public static IGangCommandExecutor <TStateData> RegisterHandler <TStateData, TCommandData>(
     this IGangCommandExecutor <TStateData> executor,
     Func <GangCommand <TCommandData>, GangState <TStateData> > action
     )
     where TStateData : class, new()
     where TCommandData : class
 {
     return(executor.RegisterHandler <TCommandData>(
                GangCommandHandler <TStateData> .From(action)
                ));
 }
Beispiel #3
0
 public static IGangCommandExecutor <TStateData> RegisterHandler <TStateData, TCommandData>(
     this IGangCommandExecutor <TStateData> executor,
     IGangCommandHandler <TStateData, TCommandData> handler
     )
     where TStateData : class, new()
     where TCommandData : class
 {
     return(executor.RegisterHandler <TCommandData>(
                GangCommandHandler <TStateData> .From(handler)
                ));
 }
Beispiel #4
0
 IGangCommandExecutor <TStateData> IGangCommandExecutor <TStateData>
 .RegisterHandlerProvider <TCommandData>(Func <IGangCommandHandler <TStateData, TCommandData> > provider)
 {
     return(new GangCommandExecutor <TStateData>(
                _serialization,
                _handlers.Values.Append(
                    GangCommandHandler <TStateData> .From(
                        (GangState <TStateData> state, GangCommand <TCommandData> command)
                        => provider().HandleAsync(state, command))
                    )
                ));
 }