O'Reilly logo

Implementing Domain-Driven Design by Vaughn Vernon

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Event Serializers

It’s wise to choose a serializer that favors versioning and renaming Events. This is especially true early on in an A+ES project as the domain model tends to evolve rapidly. Consider this Event, which is declared using a .NET implementation of Protocol Buffers1 annotations:

1. Protocol Buffers was originated by Google. Others have created .NET implementations.

[DataContract] public class ProjectClosed {   [DataMember(Order=1)] public long ProjectId { get; set; }   [DataMember(Order=2)] public DateTime Closed { get; set; } }

Now, if we were to serialize ProjectClosed using DataContractSerializer or JsonSerializer rather than Protocol Buffers, any renamed members could easily break dependent consumers. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required