Awesome
Zebus Message DSL
This is a DSL which simplifies the writing of ProtoBuf contracts for Zebus.
NuGet packages
Zebus.MessageDsl
provides the DSL parser, C# and proto generatorsZebus.MessageDsl.Build
provides a MSBuild code generator which will translate.msg
files in your projectZebus.MessageDsl.Generator
provides a Roslyn source generator which will translate.msg
files in your project
Documentation
- DSL Syntax
- Build-Time Code Generator (
.msg
files)
Example
Input file:
SomeMessage(int foo, string[] bar)
Generated code:
[ProtoContract]
public sealed partial class SomeMessage : IEvent
{
[ProtoMember(1, IsRequired = true)]
public int Foo { get; private set; }
[ProtoMember(2, IsRequired = false)]
public string[] Bar { get; private set; }
private SomeMessage()
{
Bar = Array.Empty<string>();
}
public SomeMessage(int foo, string[] bar)
{
Foo = foo;
Bar = bar;
}
}