Skip to content

Latest commit

 

History

History
99 lines (70 loc) · 2.4 KB

File metadata and controls

99 lines (70 loc) · 2.4 KB
layout default
title v0.10.0
description Release notes for Neatoo RemoteFactory v0.10.0
parent Release Notes
nav_order 2

v0.10.0 - Support for params Parameters in Factory Methods

Release Date: 2026-01-15 NuGet: Neatoo.RemoteFactory 0.10.0

Overview

Factory methods can now use C# params parameters. The generator preserves the params modifier and correctly orders parameters so CancellationToken comes before the params array.

What's New

params Parameter Support

Domain methods with params parameters now generate correct factory interfaces:

// Domain method
[Factory]
public class SearchService
{
    [Fetch]
    [Remote]
    public void Search(params string[] keywords)
    {
        // Search implementation
    }
}

// Generated factory interface
public interface ISearchServiceFactory
{
    Task<SearchService> Search(CancellationToken cancellationToken = default, params string[] keywords);
}

Usage

Due to C# rules, when an optional parameter precedes params, you must provide it explicitly to use variadic syntax:

// Valid calls
var result = await factory.Search(default, "apple", "banana", "cherry");
var result = await factory.Search(myToken, "apple", "banana");
var result = await factory.Search();  // Empty params

// Won't compile - C# binds first arg to CancellationToken
var result = await factory.Search("apple", "banana");

Mixed Parameters

Regular parameters, CancellationToken, and params work together:

// Domain
[Create]
public void CreateWithTags(int id, params string[] tags) { }

// Generated
void CreateWithTags(int id, CancellationToken cancellationToken = default, params string[] tags);

// Usage
factory.CreateWithTags(42, default, "tag1", "tag2", "tag3");

CancellationToken Flow

When domain methods accept both CancellationToken and params, the token flows correctly:

// Domain
[Create]
public void Process(CancellationToken ct, params int[] ids) { }

// Generated - CT positioned before params
void Process(CancellationToken cancellationToken = default, params int[] ids);

// The factory's cancellationToken is passed to the domain method's ct parameter

Breaking Changes

None. Existing code without params parameters is unaffected.

Bug Fixes

None.

Commits

  • feat: add params parameter support in factory method generation