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
/// models cases in which a patch should be skipped / not be applied to an entity
5
+
/// </summary>
6
+
/// <remarks>
7
+
/// Usually this shouldn't be necessary to use if everything is already. But if your data are corrupted somehow, this might be a way to still apply some patches to you data and only skip some instead of all.
8
+
/// Use this with caution (but of course we know: as soon as it's possible to ignore errors, we'll use it.
9
+
/// The state of the entity after a patch has been skipped is not well-defined.
10
+
/// It _might_ be somewhat like what you'd expect but all guarantees are gone.
11
+
/// It's the pandora's box of patching you're opening here.
12
+
/// Be sure to monitor the state of your entities after applying patches with skipped patches and <see cref="TimeRangePatchChain{TEntity}.PatchesHaveBeenSkipped"/>.
13
+
/// </remarks>
14
+
/// <typeparam name="TEntity">the entity to which the patches shall be applied</typeparam>
15
+
publicinterfaceISkipCondition<inTEntity>
16
+
{
17
+
/// <summary>
18
+
/// If applying <paramref name="failedPatch"/> to <paramref name="initialEntity"/> fails with <paramref name="errorWhilePatching"/>, the patch should be skipped.
19
+
/// </summary>
20
+
/// <param name="initialEntity">state before applying the patch <paramref name="failedPatch"/> (but not necessarily before apply any patch in the chain)</param>
21
+
/// <param name="errorWhilePatching">any error that occurred</param>
22
+
/// <param name="failedPatch">the patch that lead to the exception <paramref name="errorWhilePatching"/></param>
23
+
/// <returns>true if the patch should be skipped</returns>
catch(InvalidOperationExceptioninvalidOpException)when(invalidOpException.Message.EndsWith("out of range"))
89
108
{
90
109
// if it would crash and we do know the reasons, then we throw a more meaningful exception here instead of waiting for the base class to crash
91
-
thrownewArgumentException($"The given periods contain ambiguous starts ({string.Join(", ",ambigousStarts)}) or ends ({string.Join(", ",ambigousEnds)})",innerException:invalidOpException);
110
+
thrownewArgumentException($"The given periods contain ambiguous starts ({string.Join(", ",ambigousStarts)}) or ends ({string.Join(", ",ambigousEnds)})",
@@ -112,6 +135,8 @@ public TimeRangePatchChain(IEnumerable<TimeRangePatch>? timeperiods = null, Patc
112
135
thrownewArgumentException($"You must not add a patch {patchWithWrongDirection} with direction {patchWithWrongDirection.PatchingDirection}!={PatchingDirection}",
antiparallelInitialEntity;// we modify the reference here, but that's fine. We improve the readability but don't re-use the antiparallelInitialEntity anywhere downstream.
0 commit comments