Skip to content

Commit a473c4c

Browse files
add custom README for NuGet package which only uses Markdown as HTML is not supported by the NuGet gallary
1 parent bc64eec commit a473c4c

File tree

2 files changed

+101
-2
lines changed

2 files changed

+101
-2
lines changed

Mando/Mando/Mando.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
<Nullable>enable</Nullable>
77
<RootNamespace>Mando</RootNamespace>
88
<PackageIcon>mando.png</PackageIcon>
9-
<PackageReadmeFile>README.md</PackageReadmeFile>
9+
<PackageReadmeFile>README.NuGet.md</PackageReadmeFile>
1010
</PropertyGroup>
1111

1212
<ItemGroup>
13-
<None Include="../../README.md" Pack="true" PackagePath="\" />
13+
<None Include="../../README.NuGet.md" Pack="true" PackagePath="\" />
1414
<None Include="../../mando.png" Pack="true" PackagePath="\" />
1515
</ItemGroup>
1616

README.NuGet.md

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# Mando
2+
A super lightweight and free alternative to libraries that provide
3+
decoupled, in-process communication.
4+
5+
![Mando Logo](mando.png)
6+
7+
[![Build and Test](https://github.com/henningtandberg/Mando/actions/workflows/build-test.yml/badge.svg)](https://github.com/henningtandberg/Mando/actions/workflows/build-test.yml)
8+
![GitHub License](https://img.shields.io/github/license/henningtandberg/Mando)
9+
![GitHub Release](https://img.shields.io/github/v/release/henningtandberg/Mando)
10+
![NuGet Version](https://img.shields.io/nuget/v/Mando)
11+
![NuGet Downloads](https://img.shields.io/nuget/dt/Mando)
12+
13+
---
14+
15+
## Usage
16+
You can use the package directly or fork this repo and create your own,
17+
custom implementation.
18+
19+
## Installation
20+
The easiest way to add Mando to your project via [NuGet](https://www.nuget.org/packages/Mando).
21+
22+
## Features
23+
The features of this library are limited by design, so that the library will
24+
be easier to extend if you decide to fork the repo and create a more custom
25+
implementation. The core features are, and will always be:
26+
27+
### Single command, single handler.
28+
```csharp
29+
internal sealed MyCustomCommand : ICommand;
30+
31+
internal sealed MyCustomCommandHandler : ICommandHandler<MyCustomCommand>
32+
{
33+
public Task Execute(MyCustomCommand command)
34+
{
35+
// Your magic here!
36+
}
37+
}
38+
```
39+
40+
### Single command, multiple handlers.
41+
```csharp
42+
internal sealed MyCustomCommand : ICommand;
43+
44+
internal sealed MyCustomCommandHandlerOne : ICommandHandler<MyCustomCommand>
45+
{
46+
public Task Execute(MyCustomCommand command)
47+
{
48+
// Your magic here!
49+
}
50+
}
51+
52+
internal sealed MyCustomCommandHandlerTwo : ICommandHandler<MyCustomCommand>
53+
{
54+
public Task Execute(MyCustomCommand command)
55+
{
56+
// And some other magic here!
57+
}
58+
}
59+
```
60+
61+
### Multiple commands, single handler
62+
63+
```csharp
64+
internal sealed MyCustomCommandOne : ICommand;
65+
internal sealed MyCustomCommandTwo : ICommand;
66+
67+
internal sealed MyCustomCommandHandler :
68+
ICommandHandler<MyCustomCommandOne>, ICommandHandler<MyCustomCommandTwo>
69+
{
70+
public Task Execute(MyCustomCommandOne command)
71+
{
72+
// Your magic here!
73+
}
74+
75+
public Task Execute(MyCustomCommandTwo command)
76+
{
77+
// Even more magic here!
78+
}
79+
}
80+
```
81+
82+
### Dependency Injection
83+
```csharp
84+
services.AddMando(Assembly.GetExecutingAssembly()))
85+
```
86+
87+
This registers
88+
- `ICommandHandler<TCommand>` : All implementations are registered as Scoped
89+
- `IDispatcher` as Scoped
90+
91+
### Usage
92+
```csharp
93+
internal sealed class Application(IDispatcher dispatcher) : IApplication
94+
{
95+
public Task RunAsync() => dispatcher.Dispatch(new DoSomethingCommand());
96+
}
97+
```
98+
99+
Checkout [Mando.Example](https://github.com/henningtandberg/Mando/tree/main/Mando/Mando.Example) for a working example.

0 commit comments

Comments
 (0)