BinderDyn.OrchardCore.EventSourcing
1.2.2
dotnet add package BinderDyn.OrchardCore.EventSourcing --version 1.2.2
NuGet\Install-Package BinderDyn.OrchardCore.EventSourcing -Version 1.2.2
<PackageReference Include="BinderDyn.OrchardCore.EventSourcing" Version="1.2.2" />
paket add BinderDyn.OrchardCore.EventSourcing --version 1.2.2
#r "nuget: BinderDyn.OrchardCore.EventSourcing, 1.2.2"
// Install BinderDyn.OrchardCore.EventSourcing as a Cake Addin
#addin nuget:?package=BinderDyn.OrchardCore.EventSourcing&version=1.2.2
// Install BinderDyn.OrchardCore.EventSourcing as a Cake Tool
#tool nuget:?package=BinderDyn.OrchardCore.EventSourcing&version=1.2.2
BinderDyn.OrchardCore.EventSourcing
This package is meant to be used with OrchardCore. List events, handle them and get a history in a relational table besides your other tables.
Hint
This will work only with SQL-Server, Postgres and MySQL and with a unique database for each tenant. I didn't find a way to get this working with SQLite or with multiple tenants in one database.
Usage
- Install the package via nuget in the project that consumes the API
- Add code that interacts with the event service. This is the main interface for storing, reading and processing the events.
// Example from the repository with a content part handler public class BookHandler : ContentPartHandler<Book> { private readonly IServiceProvider _serviceProvider; public BookHandler(IServiceProvider serviceProvider) { _serviceProvider = serviceProvider; } public override async Task PublishedAsync(PublishContentContext context, Book instance) { var eventService = _serviceProvider.GetRequiredService<IEventService>(); await eventService.Add(instance.BookTitle.Text, "BookAddedEvent", instance.ContentItem.ContentItemId); await base.PublishedAsync(context, instance); } }
- Activate the feature in the tenant you want to use it for
- You can view the created events in the 'Events' menu point in the admin frontend
Create Events
Directly taken from the interface:
Task<Guid> Add(object payload, string friendlyName, string? referenceId = null, Guid? originalEventId = null);
The payload can be any object as long as it is serializable. You can use referenceId to query via the event repository (e.g. for linking content items or storing other information).
Get pending events
// Gets the oldest event pending from the event store
Task<Event> GetNextPending(string? referenceId = null);
Again, you can use the referenceId for querying a specific event.
Event states
// Set the event state of a specific event
Task SetInProcessing(Guid eventId);
Task SetAsProcessed(Guid eventId);
Task SetAsFailed(Guid eventId);
Task SetAsAborted(Guid eventId);
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net7.0
- BinderDyn.OrchardCore.EventSourcing.Abstractions (>= 1.2.2)
- BinderDyn.OrchardCore.EventSourcing.MySql (>= 1.2.2)
- BinderDyn.OrchardCore.EventSourcing.Postgres (>= 1.2.2)
- BinderDyn.OrchardCore.EventSourcing.SqlServer (>= 1.2.2)
- OrchardCore.Abstractions (>= 1.7.2)
- OrchardCore.Admin.Abstractions (>= 1.7.2)
- OrchardCore.Data.YesSql.Abstractions (>= 1.7.2)
- OrchardCore.DisplayManagement (>= 1.7.2)
- OrchardCore.Infrastructure (>= 1.7.2)
- OrchardCore.Module.Targets (>= 1.7.2)
- OrchardCore.Navigation.Core (>= 1.7.2)
- YesSql.Abstractions (>= 3.4.0)
- YesSql.Core (>= 3.4.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.