Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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