Messages
Messages in Mass Transit are nothing more than POCO classes. Messages should be immutable but some serializers may not support this design and will instead have to be enforced through coding standards. I am working on a NDepend CQL Query that will help to ensure this happens (NDepend has a feature called Immutability).
[Serializable] //if using the binary serializer
public class YourMessage
{
public string Name { get; set; }
public int Age { get; set; }
}
NDepend CQL
SELECT Types WHERE FullNameLike "Messages" //looks for messages in a 'Messages' namespace AND !IsImmutable
Its also important to note that every serializer does support an object graph, so that something like this is entirely possible
public class OrderUp
{
public IList<Order> Orders { get; set; }
public Waitstaff WaiterWhoTookOrder { get; set; }
public DateTime OrderWasReadyAt { get; set; }
}
Articles to Read
DDDD 4: Messages are value objects – Greg Young Immutable Types – Patrick Smacchia