Skip to content

Latest commit

 

History

History
87 lines (66 loc) · 2.83 KB

File metadata and controls

87 lines (66 loc) · 2.83 KB
layout default
title v0.13.0
description Release notes for Neatoo RemoteFactory v0.13.0
parent Release Notes
nav_order 2

v0.13.0 - [Execute] on Class Factories

Release Date: 2026-02-18 NuGet: Neatoo.RemoteFactory 0.13.0

Overview

Adds support for [Execute] methods on non-static [Factory] classes, enabling orchestration logic to be co-located with the aggregate it operates on. Execute methods appear on the same factory interface as Create, Fetch, and Save.

What's New

[Execute] on Class Factories

public static methods decorated with [Execute] on a [Factory] class generate a method on the factory interface. This is ideal for operations that create or return an instance of the containing type, such as create-or-fetch patterns:

public interface IConsultation
{
    long PatientId { get; }
    string Status { get; }
}

[Factory]
public partial class Consultation : IConsultation
{
    public long PatientId { get; set; }
    public string Status { get; set; } = string.Empty;

    [Remote, Create]
    public Task CreateAcute(long patientId, [Service] IRepository repo) { ... }

    [Remote, Fetch]
    public Task<bool> FetchActive(long patientId, [Service] IRepository repo) { ... }

    [Remote, Execute]
    public static async Task<IConsultation> StartForPatient(
        long patientId,
        [Service] IConsultationFactory factory,
        [Service] IRepository repo)
    {
        var existing = await factory.FetchActive(patientId);
        if (existing != null) return existing;
        return await factory.CreateAcute(patientId);
    }
}

Generated factory interface:

public interface IConsultationFactory
{
    Task<IConsultation> CreateAcute(long patientId, CancellationToken ct = default);
    Task<IConsultation?> FetchActive(long patientId, CancellationToken ct = default);
    Task<IConsultation> StartForPatient(long patientId, CancellationToken ct = default);
}

Key characteristics:

  • Methods must be public static (unlike static factory Execute which uses private static)
  • Return type must be the containing type or its matching I{ClassName} interface
  • When a matching interface exists, all factory methods return the interface type
  • [Service] parameters are injected server-side; non-service parameters become factory method parameters

Breaking Changes

None

Bug Fixes

None

Commits

  • 3768f4f - feat: support [Execute] static methods on non-static [Factory] classes
  • 94b3b9e - test: add [Execute] tests for class factories with matching interface return type
  • 5281f8d - test: make interface return types the norm in class Execute tests
  • ea67a4e - docs: document [Execute] on class factory in docs and skill
  • 7459961 - docs: use MarkdownSnippets for class factory Execute code samples