PayrollEngine.Core 0.10.0-beta.1

This is a prerelease version of PayrollEngine.Core.
dotnet add package PayrollEngine.Core --version 0.10.0-beta.1
                    
NuGet\Install-Package PayrollEngine.Core -Version 0.10.0-beta.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="PayrollEngine.Core" Version="0.10.0-beta.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PayrollEngine.Core" Version="0.10.0-beta.1" />
                    
Directory.Packages.props
<PackageReference Include="PayrollEngine.Core" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add PayrollEngine.Core --version 0.10.0-beta.1
                    
#r "nuget: PayrollEngine.Core, 0.10.0-beta.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package PayrollEngine.Core@0.10.0-beta.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=PayrollEngine.Core&version=0.10.0-beta.1&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=PayrollEngine.Core&version=0.10.0-beta.1&prerelease
                    
Install as a Cake Tool

Payroll Engine Core

Part of the Payroll Engine open-source payroll automation framework. Full documentation at payrollengine.org.

The Payroll Engine core library, used by every other component:

  • Payroll exceptions (PayrollException, PayrunException, PersistenceException, QueryException)
  • Logger abstraction ILogger with static Log facade and PayrollNullLogger fallback
  • Document abstraction for reports (IDataMerge)
  • Value conversion (ValueConvert, ValueType, ValueBaseType)
  • Common types and extension methods
  • JSON and CSV serialization (DefaultJsonSerializer, CsvSerializer, ClientJsonSerializer)
  • Payroll DataSet convertible to the ADO.NET DataSet
  • Program configuration from system environment and configuration files
  • Password hashing with SHA-256 and PBKDF2 (HashSaltExtensions, UserPassword)
  • OData query support (Query, QueryFactory, QuerySpecification)
  • Date and period calculations (Date, DatePeriod, IPayrollPeriod)
  • Action scripting framework (ActionSpecification, MarkerType)
  • Object comparison and copy tools (CompareTool, CopyTool)
  • System and scripting specification constants (SystemSpecification, ScriptingSpecification)

Project Structure

PayrollEngine.Core/
├── Core/                         # Library source
│   ├── Action/                   # Scripting action framework
│   ├── Data/                     # Payroll DataSet, DataTable, DataRow, DataColumn
│   ├── Document/                 # Document merge abstraction
│   ├── IO/                       # File utilities
│   ├── Serialization/            # JSON and CSV serializers
│   └── *.cs                      # Core types, extensions and tools
├── Directory.Build.props         # Shared build properties
├── PayrollEngine.Core.sln        # Solution file
└── README.md

Key Namespaces

Namespace Description
PayrollEngine Core types, enums, extensions, logging, configuration
PayrollEngine.Data Payroll data model (DataSet, DataTable, DataRow, DataColumn) with ADO.NET conversion
PayrollEngine.Serialization JSON and CSV serialization (DefaultJsonSerializer, CsvSerializer)
PayrollEngine.Document Document merge abstraction and metadata
PayrollEngine.Action Scripting action specifications and markers
PayrollEngine.IO File extensions and tools

Value Types

The ValueType enum defines all supported case field value types:

Value Base Type Description
String string Text value
Boolean boolean True/false
Integer numeric Integer number
NumericBoolean numeric Non-zero = true
Decimal numeric Decimal number
DateTime string Date and time (ISO 8601)
Date string Date only
None null No value
Weekday int 0–6 Day of week
Month int 0–11 Month of year
Year int Calendar year
Money decimal Monetary amount
Percent decimal Percentage
WebResource string URL or web resource

ValueConvert serializes and deserializes any ValueType to and from its JSON representation, with culture-aware datetime parsing.


Function Types

The FunctionType flags enum identifies all payroll scripting function types. Composite values allow targeting groups of functions:

Value Description
CaseAvailable Case availability check
CaseBuild Case build
CaseValidate Case input validation
CaseRelationBuild / CaseRelationValidate Case relation functions
CollectorStart / CollectorApply / CollectorEnd Collector lifecycle
WageTypeValue / WageTypeResult Wage type calculation and result
PayrunStart / PayrunEnd Payrun lifecycle
PayrunEmployeeAvailable / PayrunEmployeeStart / PayrunEmployeeEnd Employee payrun lifecycle
PayrunWageTypeAvailable Wage type availability during payrun
ReportBuild / ReportStart / ReportEnd Report lifecycle
Case, CaseRelation, Collector, WageType, PayrunBase Composite groups
Payroll, Report, All Top-level composite groups

Date & Period Calculations

The static Date class provides UTC-based date helpers:

// Boundaries
Date.MinValue        // DateTime.MinValue as UTC
Date.MaxValue        // DateTime.MaxValue as UTC
Date.Now             // DateTime.UtcNow
Date.Today           // UTC date only

// Period boundaries
Date.FirstMomentOfMonth(2026, 3)   // 2026-03-01 00:00:00
Date.LastMomentOfMonth(2026, 3)    // 2026-03-31 23:59:59.9999999
Date.IsLastMomentOfDay(moment)     // tick-precise boundary check

// Date expression parser (also used by Input Attributes)
Date.Parse("today", culture)            // today
Date.Parse("previousmonth", culture)    // first day of last month
Date.Parse("offset:3m", culture)        // 3 months from today
Date.Parse("offset:-5d", culture)       // 5 days ago

DatePeriod represents a closed or open interval. An open end defaults to Date.MaxValue; an open start defaults to Date.MinValue:

var period = new DatePeriod(start, end);
bool open = period.IsOpen;       // true if start or end is unbounded
bool anytime = period.IsAnytime; // true if both are unbounded
double days = period.TotalDays;

Logging

The static Log class provides a global logging facade. It is safe to use before configuration — the default PayrollNullLogger silently discards all messages until a logger is set:

// configure logging
Log.SetLogger(myLogger);

// use logging
Log.Trace("Verbose detail");
Log.Debug("Starting up at {StartedAt}.", DateTime.Now);
Log.Information("Processed {Count} items", items.Count);
Log.Warning("Skipped {Count} records.", skipped);
Log.Error(exception, "Processing failed");
Log.Critical("Process terminating.");

// check if a logger has been configured
if (Log.HasLogger) { ... }

Password Security

Password hashing uses PBKDF2 with SHA-256 (100,000 iterations) and constant-time comparison to prevent timing attacks:

// create hash + salt
var hashSalt = "myPassword".ToHashSalt();

// verify password
bool isValid = hashSalt.VerifyPassword("myPassword");

OData Query Support

Query carries OData-style query parameters used across all GET endpoints:

var query = new Query
{
    Filter = "Status eq 'Active'",
    OrderBy = "Name asc",
    Top = 25,
    Skip = 0,
    Result = QueryResultType.Items
};

QueryFactory builds typed query instances; QuerySpecification validates and normalizes query parameters before execution.


Payroll Data Model

The PayrollEngine.Data namespace provides a serializable data model that converts to/from ADO.NET:

// create payroll data set
var dataSet = new DataSet { Name = "MyData" };

// convert to ADO.NET
System.Data.DataSet systemDataSet = dataSet.ToSystemDataSet();

// convert back
DataSet payrollDataSet = systemDataSet.ToPayrollDataSet();

System Specification

SystemSpecification defines the global constants shared by all components:

Constant Value Description
PayrollApiConfiguration PayrollApiConfiguration Env var: path to API config JSON file
PayrollApiConnection PayrollApiConnection Env var: API connection string
PayrollApiKey PayrollApiKey Env var: static API key
PayrollDatabaseConnection PayrollDatabaseConnection Config key: database connection string
TextAttributePrefix TA_ Prefix for text attribute columns
DateAttributePrefix DA_ Prefix for date attribute columns
NumericAttributePrefix NA_ Prefix for numeric attribute columns
DecimalPrecision 28 SQL decimal precision
DecimalScale 6 SQL decimal scale
PayrunMaxExecutionCount 100 Maximum payrun retro execution depth

Scripting Specification

ScriptingSpecification defines the constants that govern the C# scripting subsystem:

Constant Value Description
ScriptingVersion 1.0.0 Current scripting API version
CSharpLanguageVersion CSharp14 Roslyn language version used for compilation
SealedTag #sealed Script tag preventing derivation
ActionRegion Action C# region name for action code
FunctionRegion Function C# region name for function code

Configuration

HTTP Client Configuration

The Payroll HTTP configuration includes the following data to connect to the backend:

  • BaseUrl — the base API URL (required)
  • Port — the base API port
  • Timeout — the connection timeout
  • ApiKey — the API access key

Database Connection String

The backend database connection string is determined by the following priority:

  1. Environment variable PayrollDatabaseConnection
  2. Program configuration file appsettings.json

Program Configuration Options

The ProgramConfiguration<TApp> class supports:

  • AppSettings — load from appsettings.json (optional, no exception if missing)
  • UserSecrets — .NET user secrets

NuGet Package

Available on NuGet.org:

dotnet add package PayrollEngine.Core

Build

Environment variable used during build:

Variable Description
PayrollEnginePackageDir Output directory for the NuGet package (optional)

License

This project is licensed under the MIT License.


See Also

  • Client Core — client-side model and service layer built on top of this library
  • Client Scripting — scripting function API
  • Backend — uses this library for domain types and query infrastructure
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on PayrollEngine.Core:

Package Downloads
PayrollEngine.Client.Core

Payroll Engine Client Core

PayrollEngine.Serilog

Payroll Engine Serilog

PayrollEngine.Document

Payroll Engine Document

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.10.0-beta.1 95 3/9/2026
0.9.0-beta.17 90 2/18/2026
0.9.0-beta.16 82 2/11/2026
0.9.0-beta.15 81 2/5/2026
0.9.0-beta.14 89 1/14/2026
0.9.0-beta.13 104 1/7/2026
0.9.0-beta.12 220 11/5/2025
0.9.0-beta.11 246 10/13/2025
0.9.0-beta.10 264 9/14/2025
0.9.0-beta.9 273 8/26/2025
0.9.0-beta.8 288 8/25/2025
0.9.0-beta.7 159 8/11/2025
0.9.0-beta.6 271 3/27/2025
0.9.0-beta.5 108 3/14/2025
0.9.0-beta.4 169 3/12/2025
0.9.0-beta.3 120 2/25/2025
0.9.0-beta.1 157 2/12/2025
0.8.0-beta.2 172 7/10/2024
0.8.0-beta.1 250 11/27/2023
0.6.0-beta.11 129 10/10/2023
Loading failed