I'm trying to decide what information my Event DTOs should contain in a pub/sub scenario.
I see two possibilities:
1) All the information that could be needed by subscribers
interface UserInvitedToGroup
{
string GroupName {get; set;}
string UserName {get; set;}
DateTime DateInvited {get; set;}
// etc, etc ...
}
or
2) Just the Id's of the entities affected.
interface UserInvitedToGroup
{
int GroupId {get; set;}
int UserId {get; set;}
}
Obviously in this scenario the subscriber would need access to the data store as well to get the information that is actually usable.
I lean towards 开发者_运维问答the second since I am not sure exactly the information a subscriber will need.
I would recommend #2. Then have you subscribers subscribe to your UserCreated and GroupCreated events as well if they are interested in the user or group details.
精彩评论