You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: CHANGELOG.md
+13
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,19 @@
2
2
3
3
Represents the **NuGet** versions.
4
4
5
+
## v3.11.0
6
+
-*Enhancement*: The `ITypedToResult` updated to correctly implement `IToResult` as the simple `ToResult` where required.
7
+
-*Enhancement*: Added `Result.AsTask()` and `Result<T>.AsTask` to simplify the conversion to a completed `Task<Result>` or `Task<Result<T>>` where applicable.
8
+
-*Enhancement*: Added `IResult.IsFailureOfType<TException>` to indicate whether the result is in a failure state and the underlying error is of the specified `TException` type.
9
+
-*Enhancement*: Added `EventTemplate` property to the `WebApiPublisherArgs` and `WebApiPublisherCollectionArgs` to define an `EventData` template.
10
+
-*Enhancement*: Added `SubscriberBase<T>` constructor overload to enable specification of `valueValidator` and `ValueIsRequired` parameters versus setting properties directly simplifying usage.
11
+
-*Enhancement:* Enum renames to improve understanding of intent for event subscribing logic: `ErrorHandling.None` is now `ErrorHandling.HandleByHost` and `ErrorHandling.Handle` is now `ErrorHandling.HandleBySubscriber`.
12
+
-*Enhancement:* Simplified the `ServiceBusSubscriber.Receive` methods by removing the `afterReceive` parameter which served no real purpose; also, reversed the `validator` and `valueIsRequired` parameters (order as stated) as the `validator` is more likely to be specified than `valueIsRequired` which defaults to `true`.
13
+
-*Enhancement*: Added `CoreEx.Hosting.Work` namespace which includes light-weight/simple foundational capabilities to track and orchestrate work; intended for the likes of [_asynchronous request-response_](https://learn.microsoft.com/en-us/azure/architecture/patterns/async-request-reply) scenarios.
14
+
- Added `IWorkStatePersistence` to enable flexible/pluggable persistence of the `WorkState` and resulting data; includes `InMemoryWorkStatePersistence` for testing, `FileWorkStatePersistence` for file-based, and `TableWorkStatePersistence` leveraging Azure table storage.
15
+
- Added `WorkStateOrchestrator` support to `EventSubscriberBase`, including corresponding `ServiceBusSubscriber` and `ServiceBusOrchestratedSubscriber` using the `ServiceBusMessage.MessageId` as the corresponding `WorkState.Id`.
16
+
- Extended `EventSubscriberArgs` to support a new `SetWorkStateDataAsync` operation to enable the setting of the underlying `WorkState` data is a consistent manner where using the event subscriber capabilities.
17
+
5
18
## v3.10.0
6
19
-*Enhancement*: The `WebApiPublisher` publishing methods have been simplified (breaking change), primarily through the use of a new _argument_ that encapsulates the various related options. This will enable the addition of further options in the future without resulting in breaking changes or adding unneccessary complexities. The related [`README`](./src/CoreEx.AspNetCore/WebApis/README.md) has been updated to document.
7
20
-*Enhancement*: Added `ValidationUseJsonNames` to `SettingsBase` (defaults to `true`) to allow setting `ValidationArgs.DefaultUseJsonNames` to be configurable.
Copy file name to clipboardexpand all lines: src/CoreEx.AspNetCore/WebApis/IWebApiPublisherArgs.cs
+36-7
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,7 @@
1
1
// Copyright (c) Avanade. Licensed under the MIT License. See https://github.com/Avanade/CoreEx
2
2
3
3
usingCoreEx.Events;
4
+
usingCoreEx.Hosting.Work;
4
5
usingCoreEx.Mapping;
5
6
usingCoreEx.Results;
6
7
usingCoreEx.Validation;
@@ -30,14 +31,25 @@ public interface IWebApiPublisherArgs<TValue, TEventValue>
30
31
/// <remarks>Will leverage either <see cref="IEventPublisher.Publish(EventData[])"/> or <see cref="IEventPublisher.PublishNamed(string, EventData[])"/> depending on whether name is specified or not.</remarks>
31
32
string?EventName{get;}
32
33
34
+
/// <summary>
35
+
/// Gets or sets the optional <see cref="EventData"/> to use as a template when instantiating the <see cref="EventData"/> for publishing.
36
+
/// </summary>
37
+
/// <remarks>Will use the <see cref="EventData(EventDataBase)"/> constructor to copy from the template.</remarks>
38
+
EventData?EventTemplate{get;}
39
+
33
40
/// <summary>
34
41
/// Gets or sets the <see cref="HttpStatusCode"/> where successful.
35
42
/// </summary>
36
43
/// <remarks>Defaults to <see cref="HttpStatusCode.Accepted"/>.</remarks>
37
44
HttpStatusCodeStatusCode{get;}
38
45
39
46
/// <summary>
40
-
/// Gets or sets the optional validator.
47
+
/// Indicates whether the <typeparamref name="TValue"/> is required.
48
+
/// </summary>
49
+
boolValueIsRequired{get;}
50
+
51
+
/// <summary>
52
+
/// Gets or sets the optional <typeparamref name="TValue"/> validator.
41
53
/// </summary>
42
54
IValidator<TValue>?Validator{get;}
43
55
@@ -48,21 +60,21 @@ public interface IWebApiPublisherArgs<TValue, TEventValue>
48
60
OperationTypeOperationType{get;}
49
61
50
62
/// <summary>
51
-
/// Gets or sets the on before validation <typeparamref name="TValue"/> modifier function.
63
+
/// Gets or sets the on before validation <typeparamref name="TValue"/> function.
52
64
/// </summary>
53
-
/// <remarks>Enables the value to be modified before validation. The <see cref="Result"/> will allow failures and alike to be returned where applicable.</remarks>
65
+
/// <remarks>Enables the likes of security, value modification, etc., before validation. The <see cref="Result"/> will allow failures and alike to be returned where applicable.</remarks>
/// Gets or sets the after validation / on before event <typeparamref name="TValue"/> modifier function.
69
+
/// Gets or sets the after validation / on before event <typeparamref name="TValue"/> function.
58
70
/// </summary>
59
-
/// <remarks>Enables the value to be modified after validation. The <see cref="Result"/> will allow failures and alike to be returned where applicable.</remarks>
71
+
/// <remarks>Enables the likes of security, value modification, etc., after validation. The <see cref="Result"/> will allow failures and alike to be returned where applicable.</remarks>
/// Gets or sets the <see cref="EventData"/> modifier function.
64
76
/// </summary>
65
-
/// <remarks>Enables the corresponding <see cref="EventData"/> to be modified prior to publish.</remarks>
77
+
/// <remarks>Enables the corresponding <see cref="EventData"/> to be modified prior to publish beyond the <see cref="EventTemplate"/> application.</remarks>
66
78
Action<EventData>?OnEvent{get;}
67
79
68
80
/// <summary>
@@ -75,6 +87,23 @@ public interface IWebApiPublisherArgs<TValue, TEventValue>
75
87
/// Gets or sets the function to override the creation of the success <see cref="IActionResult"/>.
76
88
/// </summary>
77
89
/// <remarks>Defaults to a <see cref="ExtendedStatusCodeResult"/> using the defined <see cref="StatusCode"/>.</remarks>
/// Gets or sets the function to create the <see cref="Uri"/> for the <see cref="Microsoft.AspNetCore.Http.Headers.ResponseHeaders.Location"/>.
94
+
/// </summary>
95
+
/// <remarks>
96
+
/// Where enabling the likes of the <i>asynchronous request-response</i> pattern then the <see cref="EventDataBase.Id"/> represents the <see cref="WorkState.Id"/> which is the unique identifier for the work instance and is therefore required.
97
+
/// <para>This will not be invoked automatically where the <see cref="CreateSuccessResultAsync"/> is overridden.</para></remarks>
/// Gets or sets the function to create the <see cref="WorkStateArgs"/>.
102
+
/// </summary>
103
+
/// <remarks><para>The <see cref="WorkStateArgs.Id"/> and <see cref="WorkStateArgs.CorrelationId"/> will be overridden by the <see cref="EventData"/> equivalents after creation to ensure consistencey; therefore, these properties need
104
+
/// not be set during create. The <see cref="WorkStateArgs.Key"/> will be set to the <see cref="EventDataBase.Key"/> where <c>null</c>, so also does not need to be explicitly set.</para>
105
+
/// An <see cref="InvalidOperationException"/> will occur where this is set and the corresponding <see cref="WebApiPublisher.WorkStateOrchestrator"/> is <c>null</c>. The combination of the two enables
106
+
/// the automatic create (<see cref="WorkStateOrchestrator.CreateAsync(WorkStateArgs, CancellationToken)"/>) of <see cref="WorkState"/> tracking to enable the likes of the <i>asynchronous request-response</i> pattern.</remarks>
Copy file name to clipboardexpand all lines: src/CoreEx.AspNetCore/WebApis/IWebApiPublisherCollectionArgs.cs
+7-1
Original file line number
Diff line number
Diff line change
@@ -33,6 +33,12 @@ public interface IWebApiPublisherCollectionArgs<TColl, TItem, TEventItem> where
33
33
/// <remarks>Will leverage either <see cref="IEventPublisher.Publish(EventData[])"/> or <see cref="IEventPublisher.PublishNamed(string, EventData[])"/> depending on whether name is specified or not.</remarks>
34
34
string?EventName{get;}
35
35
36
+
/// <summary>
37
+
/// Gets or sets the optional <see cref="EventData"/> to use as a template when instantiating the <see cref="EventData"/> for publishing.
38
+
/// </summary>
39
+
/// <remarks>Will use the <see cref="EventData(EventDataBase)"/> constructor to copy from the template.</remarks>
40
+
EventData?EventTemplate{get;}
41
+
36
42
/// <summary>
37
43
/// Gets or sets the <see cref="HttpStatusCode"/> where successful.
38
44
/// </summary>
@@ -84,6 +90,6 @@ public interface IWebApiPublisherCollectionArgs<TColl, TItem, TEventItem> where
84
90
/// Gets or sets the function to override the creation of the success <see cref="IActionResult"/>.
85
91
/// </summary>
86
92
/// <remarks>Defaults to a <see cref="ExtendedStatusCodeResult"/> using the defined <see cref="StatusCode"/>.</remarks>
0 commit comments