Skip to content

Missing typed async convenience methods for computed key overloads #189

Description

@dguisinger

Problem

The source generator produces typed parameter overloads for builder-returning methods (Get, Delete, Update, ConditionCheck) when an entity has computed keys with 2+ source properties. However, it does not generate the corresponding async convenience methods (GetAsync, DeleteAsync).

The standard (non-computed) flow generates both:

  • Get(string pK, string sK) → builder
  • GetAsync(string pK, string sK, CancellationToken) → one-shot execution

But the typed overloads only generate the builder variant:

  • ✅ Get(int year, int month, int day, string sK) → builder
  • ❌ GetAsync(int year, int month, int day, string sK, CancellationToken) → missing

Current workaround

Users must chain the terminal method manually:

var event = await table.ScheduledEvents.Get(2024, 12, 25, "christmas-party").GetItemAsync();
await table.ScheduledEvents.Delete(2024, 12, 25, "christmas-party").DeleteAsync();

Expected behavior

Typed async convenience methods should be generated alongside the builder overloads:

var event = await table.ScheduledEvents.GetAsync(2024, 12, 25, "christmas-party");
await table.ScheduledEvents.DeleteAsync(2024, 12, 25, "christmas-party");

Scope

The following typed async convenience methods should be generated when an entity qualifies for typed overloads:

Method Signature pattern Delegates to
GetAsync Task<T?> GetAsync({typedParams}, CancellationToken) Get({typedParams}).GetItemAsync(ct)
DeleteAsync Task DeleteAsync({typedParams}, KeyCondition, CancellationToken) Delete({typedParams}).WithKeyCondition(kc).DeleteAsync(ct)

Update does not have an async convenience method in the standard flow (requires .Set(...) before execution), so no typed UpdateAsync is needed.

Additional considerations

  • GetAsyncResult (FluentResults) variant should also be generated if [UseFluentResults] is present
  • DeleteAsyncResult variant likewise
  • Table-level typed async methods should mirror the entity accessor ones
  • The KeyCondition parameter on DeleteAsync should follow the same pattern as the standard DeleteAsync overloads

Affected code

  • TableGenerator.cs
    — GenerateTypedGetOverload and GenerateTypedDeleteOverload need to emit async counterparts after the builder method (same pattern as the standard GenerateAccessorGetMethod / GenerateAccessorDeleteMethod)
  • ComputedKeyTypedOverloadsApiSurface.cs
    — add test cases for the new async methods

Metadata

Metadata

Assignees

Labels

Type

Fields

No fields configured for Bug.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions