IAdjustmentHandler Interface
Definition
- Namespace
- Bodu.Globalization.Calendar
- Assembly
- Bodu.Globalization.Calendar.dll
- Package
- Bodu.Globalization.Calendar 1.3.0
- Source
- IAdjustmentHandler.cs
Computes the observed date of an occurrence for an adjustment policy whose action is Custom, supplementing the engine's built-in actions with caller-supplied logic.
public interface IAdjustmentHandler
- Extension Methods
Examples
// Move the occurrence to the first later day that no non-working occurrence has claimed. The claimed days include
// this occurrence's own actual date when it is non-working, so the search starts the day after it.
public sealed class NextFreeDayHandler : IAdjustmentHandler
{
public DateOnly? Adjust(AdjustmentHandlerContext context)
{
DateOnly date = context.BaseDate.AddDays(1);
while (context.IsOccupied(date))
date = date.AddDays(1);
return date;
}
}
Remarks
A handler is bound to a policy through the policy's handler key and is consulted during the placement phase, after the actual date has been calculated. It receives the calculated date together with the surrounding resolution context, so it can resolve other rules or test whether candidate days are already claimed by non-working occurrences (the claimed days include the occurrence's own actual date when it is non-working).
Methods
Adjust(AdjustmentHandlerContext)
Computes the observed date for an occurrence.
DateOnly? Adjust(AdjustmentHandlerContext context)
Parameters
contextAdjustmentHandlerContextThe context describing the occurrence being adjusted.
Returns
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |