diff --git a/README.md b/README.md index 1a178c5..5ded38b 100644 --- a/README.md +++ b/README.md @@ -3,13 +3,15 @@ [![Build](https://github.com/Abc-Arbitrage/Zebus.MessageDsl/workflows/Build/badge.svg)](https://github.com/Abc-Arbitrage/Zebus.MessageDsl/actions?query=workflow%3ABuild) [![Zebus.MessageDsl NuGet](https://img.shields.io/nuget/v/Zebus.MessageDsl.svg?label=Zebus.MessageDsl&logo=NuGet)](https://www.nuget.org/packages/Zebus.MessageDsl) [![Zebus.MessageDsl.Build NuGet](https://img.shields.io/nuget/v/Zebus.MessageDsl.Build.svg?label=Zebus.MessageDsl.Build&logo=NuGet)](https://www.nuget.org/packages/Zebus.MessageDsl.Build) +[![Zebus.MessageDsl.Generator NuGet](https://img.shields.io/nuget/v/Zebus.MessageDsl.Generator.svg?label=Zebus.MessageDsl.Generator&logo=NuGet)](https://www.nuget.org/packages/Zebus.MessageDsl.Generator) This is a DSL which simplifies the writing of ProtoBuf contracts for [Zebus](https://github.com/Abc-Arbitrage/Zebus). ## NuGet packages - [`Zebus.MessageDsl`](https://www.nuget.org/packages/Zebus.MessageDsl) provides the DSL parser, C# and proto generators - - [`Zebus.MessageDsl.Build`](https://www.nuget.org/packages/Zebus.MessageDsl.Build) provides a code generator which will translate `.msg` files in your project + - [`Zebus.MessageDsl.Build`](https://www.nuget.org/packages/Zebus.MessageDsl.Build) provides a MSBuild code generator which will translate `.msg` files in your project + - [`Zebus.MessageDsl.Generator`](https://www.nuget.org/packages/Zebus.MessageDsl.Generator) provides a Roslyn source generator which will translate `.msg` files in your project ## Documentation @@ -28,8 +30,6 @@ Generated code: ```C# [ProtoContract] -[System.Diagnostics.DebuggerNonUserCode] -[System.CodeDom.Compiler.GeneratedCode("Abc.Zebus.MessageDsl.Build", "0.3.0.0")] public sealed partial class SomeMessage : IEvent { [ProtoMember(1, IsRequired = true)] diff --git a/src/Abc.Zebus.MessageDsl.sln b/src/Abc.Zebus.MessageDsl.sln index 8088931..4de0e0d 100644 --- a/src/Abc.Zebus.MessageDsl.sln +++ b/src/Abc.Zebus.MessageDsl.sln @@ -29,6 +29,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Docs", "Docs", "{A8144077-4 ..\docs\Syntax.md = ..\docs\Syntax.md ..\docs\BuildTimeCodeGen.md = ..\docs\BuildTimeCodeGen.md ..\README.md = ..\README.md + NuGetReadme.md = NuGetReadme.md EndProjectSection EndProject Global diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 4fc8e5b..d6f7f2b 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -28,6 +28,7 @@ Copyright © ABC arbitrage $([System.DateTime]::Now.ToString('yyyy')) true $(MSBuildThisFileDirectory)..\output + README.md @@ -39,4 +40,8 @@ + + + + diff --git a/src/NuGetReadme.md b/src/NuGetReadme.md new file mode 100644 index 0000000..650952a --- /dev/null +++ b/src/NuGetReadme.md @@ -0,0 +1,38 @@ +# Zebus Message DSL + +This is a DSL which simplifies the writing of ProtoBuf contracts for [Zebus](https://github.com/Abc-Arbitrage/Zebus). + +See the [GitHub repository](https://github.com/Abc-Arbitrage/Zebus.MessageDsl) for more information. + +## Example + +Input file: + +```C# +SomeMessage(int foo, string[] bar) +``` + +Generated code: + +```C# +[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(); + } + + public SomeMessage(int foo, string[] bar) + { + Foo = foo; + Bar = bar; + } +} +```