This is a DSL which simplifies the writing of ProtoBuf contracts for Zebus.
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
- DSL Syntax
- Build-Time Code Generator (
.msg
files)
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;
}
}