Planner 1.2.1
dotnet add package Planner --version 1.2.1
NuGet\Install-Package Planner -Version 1.2.1
<PackageReference Include="Planner" Version="1.2.1" />
<PackageVersion Include="Planner" Version="1.2.1" />
<PackageReference Include="Planner" />
paket add Planner --version 1.2.1
#r "nuget: Planner, 1.2.1"
#:package Planner@1.2.1
#addin nuget:?package=Planner&version=1.2.1
#tool nuget:?package=Planner&version=1.2.1
Planner Library
The Planner Library is a .NET library designed to simplify task scheduling based on different execution frequencies, time intervals, and monthly patterns. It provides a flexible way to set timers for various scheduling needs.
Getting Started
Prerequisites
Make sure you have the following prerequisites installed:
- .NET SDK (version 8.0 or later)
Installation
You can install the library via NuGet. Use the following command in the Package Manager Console:
dotnet add package Planner --version *
Usage
In your code:
using Timer = Planner.Timer;
string connectionString = "your_connection_string_here";
Timer planner = new Timer(connectionString);
// Initialize timer in milliseconds (returns long for extended periods)
long timer = planner.SetTimer("YourWorkerName");
// For any delay (short or very long), use a synchronous wait with Task.Delay:
private static void SleepLong(long milliseconds)
{
var delay = TimeSpan.FromMilliseconds(milliseconds);
Task.Delay(delay).GetAwaiter().GetResult(); // Waits synchronously
}
// Now just call:
SleepLong(timer);
Features
Scheduling Options
The library supports multiple scheduling patterns:
Frequency-based Execution
- Set recurring tasks using time intervals within activity periods
- Tasks are automatically aligned to intervals from the start of activity period
worker.frequence = "00:30:00"; // Executes every 30 minutes worker.heuredebact = "08:00:00"; // Starting from 8 AM worker.heurefinact = "18:00:00"; // Until 6 PM // Will execute at: 8:00, 8:30, 9:00, 9:30, ..., 17:30 // If started at 8:15, first execution will be at 8:30Fixed Hour Execution
- Schedule tasks at specific times regardless of activity periods
- Respects only business days constraints if enabled
worker.heureexec = "14:30:00"; // Executes at 2:30 PM every dayMonthly Execution
- Execute tasks on specific days of the month (1-28 or -1 for last day)
- Support for business days
worker.is_monthly = true; worker.monthly_days = new int[] { 1, 15, -1 }; // Executes on 1st, 15th, and last day of month worker.heureexec = "14:30:00"; // At 2:30 PM // OR worker.use_business_days = true; // Executes only on business days
Activity Periods
Control when frequency-based tasks can run:
- Apply only to frequency-based execution
- Tasks are aligned to fixed intervals from the start time
- Last possible interval is calculated to ensure completion within activity period
worker.heuredebact = "08:00:00"; // Start of activity period
worker.heurefinact = "18:00:00"; // End of activity period
// With 30-min frequency, last execution will be at 17:30
Day Management
Specify allowed execution days:
worker.lundi = true; // Monday allowed
worker.mardi = true; // Tuesday allowed
// etc.
Services
TimerHandlerService
The core service managing all timer operations with three main methods:
SetTimerByFrequenceExec
public long SetTimerByFrequenceExec(FluxDetail worker);- Configures a timer based on frequency intervals
- Ensures executions align with activity periods
- Automatically calculates next valid interval
SetTimerByHourExec
public long SetTimerByHourExec(FluxDetail worker);- Configures a timer for specific hour execution
- Ignores activity periods
- Only considers business days if enabled
SetTimerByMonthlyExec
public long SetTimerByMonthlyExec(FluxDetail worker);- Configures a timer for monthly patterns execution
- Supports end-of-month scheduling with -1
Delay Handling
The library supports extended delay periods using long return type for all timer methods. This allows scheduling tasks far into the future (maximum delay of approximately 292 million years). However, when implementing the actual delay in your code, you should handle the value appropriately as shown in the usage examples above.
License
This project is licensed under the MIT License - see the LICENSE.md file for details.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Microsoft.EntityFrameworkCore (>= 9.0.0)
- Npgsql.EntityFrameworkCore.PostgreSQL (>= 9.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.2.1 | 234 | 3/28/2025 |
| 1.1.15 | 207 | 3/27/2025 |
| 1.1.14 | 193 | 3/27/2025 |
| 1.1.13 | 216 | 3/27/2025 |
| 1.1.12 | 225 | 3/20/2025 |
| 1.1.11 | 206 | 1/7/2025 |
| 1.1.9 | 196 | 12/14/2024 |
| 1.1.8 | 175 | 12/14/2024 |
| 1.1.7 | 186 | 12/13/2024 |
| 1.1.6 | 181 | 12/13/2024 |
| 1.1.5 | 181 | 12/13/2024 |
| 1.1.4 | 175 | 12/13/2024 |
| 1.1.2 | 194 | 12/12/2024 |
| 1.1.1 | 183 | 12/12/2024 |
| 1.1.0 | 180 | 12/12/2024 |
| 1.0.15 | 337 | 10/26/2023 |
| 1.0.14 | 169 | 10/26/2023 |
| 1.0.13 | 191 | 10/25/2023 |
| 1.0.12 | 278 | 10/25/2023 |
| 1.0.11 | 282 | 10/25/2023 |
Fix setDateByHourExec to increment if currentDate > RequestDate