https://github.com/simplify9/domainevents
A package that handles Domain events
https://github.com/simplify9/domainevents
Last synced: about 1 year ago
JSON representation
A package that handles Domain events
- Host: GitHub
- URL: https://github.com/simplify9/domainevents
- Owner: simplify9
- License: mit
- Created: 2020-06-07T12:04:15.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-08-13T11:47:01.000Z (almost 6 years ago)
- Last Synced: 2025-03-08T15:45:48.777Z (about 1 year ago)
- Language: C#
- Homepage:
- Size: 17.6 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
[](https://dev.azure.com/simplify9/Github%20Pipelines/_build/latest?definitionId=168&branchName=master)

| **Package** | **Version** |
| :----------------:|:----------------------:|
|```SimplyWorks.DomainEvents```| 
|```SimplyWorks.PrimitiveTypes```| 
## Introduction
[*DomainEvents*](https://www.nuget.org/packages/SimplyWorks.DomainEvents/) is a package that handles your events. When you dispatch an event, *DomainEvents* finds its relevant handlers and runs them.
Define the relevant handles by writing classes that implement the **IHandle** interface from [PrimitiveTypes](https://www.nuget.org/packages/SimplyWorks.PrimitiveTypes/).
## Getting Started
To use *DomainEvents*, you will require the [`PrimitiveTypes`](https://github.com/simplify9/PrimitiveTypes) library.
### *DomainEvents* Setup
```csharp
public static class IServiceCollectionExtensions
{
public static IServiceCollection AddDomainEvents(this IServiceCollection serviceCollection, params Assembly[] assemblies)
{
if (assemblies.Length == 0) assemblies = new Assembly[] { Assembly.GetCallingAssembly() };
serviceCollection.Scan(scan => scan
.FromAssemblies(assemblies)
.AddClasses(classes => classes.AssignableTo(typeof(IHandle<>)))
.AsImplementedInterfaces().WithScopedLifetime());
serviceCollection.AddScoped();
return serviceCollection;
}
}
```
## Getting support 👷
If you encounter any bugs, don't hesitate to submit an [issue](https://github.com/simplify9/DomainEvents/issues). We'll get back to you promptly!