Skip to content

A DSL which simplifies the writing of ProtoBuf contracts for Zebus

License

Notifications You must be signed in to change notification settings

Abc-Arbitrage/Zebus.MessageDsl

Repository files navigation

Zebus Message DSL

Build Zebus.MessageDsl NuGet Zebus.MessageDsl.Build NuGet Zebus.MessageDsl.Generator NuGet

This is a DSL which simplifies the writing of ProtoBuf contracts for Zebus.

NuGet packages

Documentation

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;
    }
}