Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

CommandBus now Dispatches instead of Publishes

  • Loading branch information...
commit 629a856a14d47fd9d2f26ce6b74ae2e8a5704421 1 parent c0b8167
Anders Ljusberg authored September 23, 2011
4  Source/Taskmaster.Service/Bus/ICommandBus.cs
@@ -6,7 +6,7 @@ namespace Taskmaster.Service.Bus
6 6
 {
7 7
     public interface ICommandBus
8 8
     {
9  
-        void Publish<T>(T command);
  9
+        void Dispatch<T>(T command);
10 10
         void RegisterHandler<T>(ICommandHandler<T> handler);
11 11
     }
12 12
 
@@ -14,7 +14,7 @@ public class CommandBus : ICommandBus
14 14
     {
15 15
         private readonly Dictionary<Type, object> _handlers = new Dictionary<Type, object>();
16 16
 
17  
-        public void Publish<T>(T command)
  17
+        public void Dispatch<T>(T command)
18 18
         {
19 19
             var type = typeof (T);
20 20
             var handler = (ICommandHandler<T>)_handlers[type];
6  Source/Taskmaster.Service/TaskService.cs
@@ -33,7 +33,7 @@ public AddTaskItemResponse AddTaskItem(AddTaskItemRequest request)
33 33
 
34 34
             Guid? assignedUserAggregateId = GetUserAggregateId(request.AssignedToUserId);
35 35
 
36  
-            _commandBus.Publish(new AddTaskItemCommand(GetUserAggregateId(request.RequestUserId).Value, taskItemAggregateId, request.Title, request.Details, assignedUserAggregateId));
  36
+            _commandBus.Dispatch(new AddTaskItemCommand(GetUserAggregateId(request.RequestUserId).Value, taskItemAggregateId, request.Title, request.Details, assignedUserAggregateId));
37 37
 
38 38
             int taskItemModelId = _identityLookup.GetModelId<Domain.TaskItem>(taskItemAggregateId);
39 39
 
@@ -50,7 +50,7 @@ public EditTaskItemResponse EditTaskItem(EditTaskItemRequest request)
50 50
 
51 51
             Guid? assignedUserAggregateId = GetUserAggregateId(request.AssignedToUserId);
52 52
 
53  
-            _commandBus.Publish(new EditTaskItemCommand(GetUserAggregateId(request.RequestUserId).Value, taskItemAggregateId, request.Title, request.Details, assignedUserAggregateId));
  53
+            _commandBus.Dispatch(new EditTaskItemCommand(GetUserAggregateId(request.RequestUserId).Value, taskItemAggregateId, request.Title, request.Details, assignedUserAggregateId));
54 54
 
55 55
             return new EditTaskItemResponse()
56 56
             {
@@ -64,7 +64,7 @@ public AddCommentResponse AddComment(AddCommentRequest request)
64 64
             Guid taskItemAggregateId = _identityLookup.GetAggregateId<Domain.TaskItem>(request.TaskItemId);
65 65
             Guid commentId = Guid.NewGuid();
66 66
 
67  
-            _commandBus.Publish(new AddCommentCommand(GetUserAggregateId(request.RequestUserId).Value, taskItemAggregateId, commentId, request.Comment));
  67
+            _commandBus.Dispatch(new AddCommentCommand(GetUserAggregateId(request.RequestUserId).Value, taskItemAggregateId, commentId, request.Comment));
68 68
 
69 69
             int commentModelId = _identityLookup.GetModelId<Domain.TaskComment>(commentId);
70 70
 
2  Source/Taskmaster.Service/UserService.cs
@@ -27,7 +27,7 @@ public AddUserResponse AddUser(AddUserRequest request)
27 27
         {
28 28
             var userAggregateId = Guid.NewGuid();
29 29
 
30  
-            _commandBus.Publish(new AddUserCommand(GetUserAggregateId(request.RequestUserId).Value, userAggregateId, request.Name));
  30
+            _commandBus.Dispatch(new AddUserCommand(GetUserAggregateId(request.RequestUserId).Value, userAggregateId, request.Name));
31 31
 
32 32
             var userModelId = _identityLookup.GetModelId<Domain.User>(userAggregateId);
33 33
 

0 notes on commit 629a856

Please sign in to comment.
Something went wrong with that request. Please try again.