@@ -88,7 +88,7 @@ for execution:
88
88
| void asynchronous command | ` IAsyncCommand ` | ` await IMessageBus.ExecuteAsync(command) ` |
89
89
| value-returning asynchronous command | ` IAsyncCommand<TResult> ` | ` var result = await IMessageBus.ExecuteAsync(command) ` |
90
90
91
- The above command can be executed using the following code:
91
+ The sample command shown before can be executed using the following code:
92
92
93
93
``` csharp
94
94
// perhaps a method invoked when a user
@@ -276,14 +276,20 @@ builder.Services.AddMessageBus();
276
276
277
277
All command handlers and event producers need to be registered with the
278
278
services collection as usual , using the main interface for the component ,
279
- such as `ICommandHandler <T >` and `IObservable <TEvent >`.
279
+ such as `ICommandHandler <T >` and `IObservable <TEvent >`.
280
+
281
+ > NOTE : *Merq * makes no assumptions about the lifetime of the registered
282
+ > components , so it 's up to the consumer to register them with the desired
283
+ > lifetime .
280
284
281
285
To drastically simplify registration of handlers and producers , we
282
286
recommend the [Devlooped .Extensions .DependencyInjection .Attributed ](https :// www.nuget.org/packages/Devlooped.Extensions.DependencyInjection.Attributed/).
283
287
package , which provides a simple attribute -based mechanism for automatically
284
288
emitting at compile -time the required service registrations for all types
285
289
marked with the provided `[Service ]` attribute , which also allows setting the
286
- component lifetime , such as `[Service (ServiceLifetime .Transient )]`.
290
+ component lifetime , such as `[Service (ServiceLifetime .Transient )]` (default
291
+ lifetime is `ServiceLifetime .Singleton ` for this source generator -based
292
+ package ).
287
293
288
294
This allows to simply mark all command handlers and event producers as
289
295
`[Service ]` and then register them all with a single line of code :
@@ -328,7 +334,7 @@ dotnet counters monitor --process-id [PROCESS_ID] --counters Merq
328
334
329
335
Example rendering from the included sample console app :
330
336
331
- ! [dotnet - counters screenshot ](https :// github.com/devlooped/Merq/blob/main/assets/img/dotnet-counters.png)
337
+ ! [dotnet - counters screenshot ](https :// github.com/devlooped/Merq/blob/main/assets/img/dotnet-counters.png?raw=true )
332
338
333
339
## Duck Typing Support
334
340
0 commit comments