-
Notifications
You must be signed in to change notification settings - Fork 53
Open
Labels
P2source generatorsIssue relates to the source generator project(s)Issue relates to the source generator project(s)
Description
Currently, the GeneratedDurableTaskExtensions class is placed in the Microsoft.DurableTask namespace, which is cluttering all sorts of IDE features from suggestions to refactoring. It would be better if a separate extensions class was generated for each namespace where the activity and orchestrator classes are, so that only the types from the same or explicitly referenced namespaces are available. After all, we probably import that namespace anyway.
Example
Suppose we have two orchestrations in different namespaces, MyDurableTaskProject.Approvals.ApprovalOrchestration and MyDurableTaskProject.Registrations.RegistrationOrchestration.
Generated code before:
namespace Microsoft.DurableTask
{
public static class GeneratedDurableTaskExtensions
{
/// <inheritdoc cref="IOrchestrationSubmitter.ScheduleNewOrchestrationInstanceAsync"/>
public static Task<string> ScheduleNewApprovalOrchestrationInstanceAsync(
this IOrchestrationSubmitter client, MyDurableTaskProject.Approvals.ApprovalOrchestrationParameters input, StartOrchestrationOptions? options = null)
{
return client.ScheduleNewOrchestrationInstanceAsync("MyDurableTaskProject.Approvals.ApprovalOrchestration", input, options);
}
/// <inheritdoc cref="IOrchestrationSubmitter.ScheduleNewOrchestrationInstanceAsync"/>
public static Task<string> ScheduleNewRegistrationOrchestrationInstanceAsync(
this IOrchestrationSubmitter client, MyDurableTaskProject.Registrations.RegistrationOrchestrationParameters input, StartOrchestrationOptions? options = null)
{
return client.ScheduleNewOrchestrationInstanceAsync("MyDurableTaskProject.Registrations.RegistrationOrchestration", input, options);
}
}After the change, it should be like this:
using Microsoft.DurableTask;
namespace MyDurableTaskProject.Approvals
{
public static class GeneratedDurableTaskExtensions
{
/// <inheritdoc cref="IOrchestrationSubmitter.ScheduleNewOrchestrationInstanceAsync"/>
public static Task<string> ScheduleNewApprovalOrchestrationInstanceAsync(
this IOrchestrationSubmitter client, ApprovalOrchestrationParameters input, StartOrchestrationOptions? options = null)
{
return client.ScheduleNewOrchestrationInstanceAsync("MyDurableTaskProject.Approvals.ApprovalOrchestration", input, options);
}
}
namespace MyDurableTaskProject.Registrations
{
public static class GeneratedDurableTaskExtensions
{
/// <inheritdoc cref="IOrchestrationSubmitter.ScheduleNewOrchestrationInstanceAsync"/>
public static Task<string> ScheduleNewRegistrationOrchestrationInstanceAsync(
this IOrchestrationSubmitter client, RegistrationOrchestrationParameters input, StartOrchestrationOptions? options = null)
{
return client.ScheduleNewOrchestrationInstanceAsync("MyDurableTaskProject.Registrations.RegistrationOrchestration", input, options);
}
}Copilot
Metadata
Metadata
Assignees
Labels
P2source generatorsIssue relates to the source generator project(s)Issue relates to the source generator project(s)