Skip to content

Instantly share code, notes, and snippets.

@ankitvijay
Created October 8, 2021 20:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ankitvijay/9a17ff86eb6f21ed8dbf98f487b84ca8 to your computer and use it in GitHub Desktop.
Save ankitvijay/9a17ff86eb6f21ed8dbf98f487b84ca8 to your computer and use it in GitHub Desktop.
NServiceBus Cosmos Sample - Messages
public interface IPostIdPartitionKey
{
string PostId { get; set; }
}
public class AddPost : ICommand, IPostIdPartitionKey
{
public AddPost(string title, string description, string author)
{
Title = title;
Description = description;
Author = author;
PostId = Guid.NewGuid().ToString();
}
public string PostId { get; set; }
public string Title { get; set; }
public string Description { get; set; }
public string Author { get; }
}
public class AddComment : ICommand, IPostIdPartitionKey
{
public AddComment(string postId, string content, string commentBy)
{
PostId = postId;
CommentId = Guid.NewGuid().ToString();
Content = content;
CommentBy = commentBy;
}
public string CommentId { get; set; }
public string PostId { get; set; }
public string Content { get; set; }
public string CommentBy { get; set; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment