Skip to content

GetObjectLookup<T>: misleading parameter order — replace with GetLookupField<T> #1

@Giannoudis

Description

@Giannoudis

Problem

GetObjectLookup<T> has the following signature:

public T GetObjectLookup<T>(string lookupName, string objectKey, string lookupKey = null, string culture = null)

The parameter order is inconsistent with GetLookup<T>(lookupName, lookupKey, culture).
Callers naturally pass the lookup key as the second argument, which silently lands in
objectKey instead — leaving lookupKey = null and causing a runtime ArgumentException.

Resolution

  • Remove GetObjectLookup<T>
  • Add GetLookupField<T> with corrected, unambiguous signature:
public T GetLookupField<T>(string lookupName, string lookupKey, string fieldName, string culture = null)

Usage

// Full object deserialization — unchanged
var param = GetLookup<SZWParam>("SZWParameter", "2026");

// Single field extraction — new
var rate = GetLookupField<decimal>("SZWParameter", "2026", "AwfLaag");

Affected file

PayrollEngine.Client.Scripting/Client.Scripting/Function/PayrollFunction.cs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions