Skip to content

Commit f4c0c5e

Browse files
CopilotYunchuWang
andcommitted
Fix merge conflict and update XML documentation to use simplified type references
Co-authored-by: YunchuWang <[email protected]>
1 parent c4879d1 commit f4c0c5e

File tree

3 files changed

+31
-19
lines changed

3 files changed

+31
-19
lines changed

src/Generators/DurableTaskSourceGenerator.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -453,9 +453,11 @@ static void AddOrchestratorCallMethod(StringBuilder sourceBuilder, DurableTaskTy
453453
inputParameter += " = default";
454454
}
455455

456+
string simplifiedTypeName = SimplifyTypeNameForNamespace(orchestrator.TypeName, targetNamespace);
457+
456458
sourceBuilder.AppendLine($@"
457459
/// <summary>
458-
/// Schedules a new instance of the <see cref=""{orchestrator.TypeName}""/> orchestrator.
460+
/// Schedules a new instance of the <see cref=""{simplifiedTypeName}""/> orchestrator.
459461
/// </summary>
460462
/// <inheritdoc cref=""IOrchestrationSubmitter.ScheduleNewOrchestrationInstanceAsync""/>
461463
public static Task<string> ScheduleNew{orchestrator.TaskName}InstanceAsync(
@@ -475,9 +477,11 @@ static void AddSubOrchestratorCallMethod(StringBuilder sourceBuilder, DurableTas
475477
inputParameter += " = default";
476478
}
477479

480+
string simplifiedTypeName = SimplifyTypeNameForNamespace(orchestrator.TypeName, targetNamespace);
481+
478482
sourceBuilder.AppendLine($@"
479483
/// <summary>
480-
/// Calls the <see cref=""{orchestrator.TypeName}""/> sub-orchestrator.
484+
/// Calls the <see cref=""{simplifiedTypeName}""/> sub-orchestrator.
481485
/// </summary>
482486
/// <inheritdoc cref=""TaskOrchestrationContext.CallSubOrchestratorAsync(TaskName, object?, TaskOptions?)""/>
483487
public static Task<{outputType}> Call{orchestrator.TaskName}Async(
@@ -497,12 +501,14 @@ static void AddActivityCallMethod(StringBuilder sourceBuilder, DurableTaskTypeIn
497501
inputParameter += " = default";
498502
}
499503

504+
string simplifiedTypeName = SimplifyTypeNameForNamespace(activity.TypeName, targetNamespace);
505+
500506
sourceBuilder.AppendLine($@"
501507
/// <summary>
502-
/// Calls the <see cref=""{activity.TypeName}""/> activity.
508+
/// Calls the <see cref=""{simplifiedTypeName}""/> activity.
503509
/// </summary>
504510
/// <inheritdoc cref=""TaskOrchestrationContext.CallActivityAsync(TaskName, object?, TaskOptions?)""/>
505-
public static Task<{activity.OutputType}> Call{activity.TaskName}Async(this TaskOrchestrationContext ctx, {activity.InputParameter}, TaskOptions? options = null)
511+
public static Task<{outputType}> Call{activity.TaskName}Async(this TaskOrchestrationContext ctx, {inputParameter}, TaskOptions? options = null)
506512
{{
507513
return ctx.CallActivityAsync<{outputType}>(""{activity.TaskName}"", input, options);
508514
}}");

test/Generators.Tests/AzureFunctionsTests.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ public class MyOrchestrator : TaskOrchestrator<{inputType}, {outputType}>
231231
}}
232232
233233
/// <summary>
234-
/// Schedules a new instance of the <see cref=""MyNS.MyOrchestrator""/> orchestrator.
234+
/// Schedules a new instance of the <see cref=""MyOrchestrator""/> orchestrator.
235235
/// </summary>
236236
/// <inheritdoc cref=""IOrchestrationSubmitter.ScheduleNewOrchestrationInstanceAsync""/>
237237
public static Task<string> ScheduleNewMyOrchestratorInstanceAsync(
@@ -241,7 +241,7 @@ public static Task<string> ScheduleNewMyOrchestratorInstanceAsync(
241241
}}
242242
243243
/// <summary>
244-
/// Calls the <see cref=""MyNS.MyOrchestrator""/> sub-orchestrator.
244+
/// Calls the <see cref=""MyOrchestrator""/> sub-orchestrator.
245245
/// </summary>
246246
/// <inheritdoc cref=""TaskOrchestrationContext.CallSubOrchestratorAsync(TaskName, object?, TaskOptions?)""/>
247247
public static Task<{outputType}> CallMyOrchestratorAsync(
@@ -315,7 +315,7 @@ public abstract class MyOrchestratorBase : TaskOrchestrator<{inputType}, {output
315315
}}
316316
317317
/// <summary>
318-
/// Schedules a new instance of the <see cref=""MyNS.MyOrchestrator""/> orchestrator.
318+
/// Schedules a new instance of the <see cref=""MyOrchestrator""/> orchestrator.
319319
/// </summary>
320320
/// <inheritdoc cref=""IOrchestrationSubmitter.ScheduleNewOrchestrationInstanceAsync""/>
321321
public static Task<string> ScheduleNewMyOrchestratorInstanceAsync(
@@ -325,7 +325,7 @@ public static Task<string> ScheduleNewMyOrchestratorInstanceAsync(
325325
}}
326326
327327
/// <summary>
328-
/// Calls the <see cref=""MyNS.MyOrchestrator""/> sub-orchestrator.
328+
/// Calls the <see cref=""MyOrchestrator""/> sub-orchestrator.
329329
/// </summary>
330330
/// <inheritdoc cref=""TaskOrchestrationContext.CallSubOrchestratorAsync(TaskName, object?, TaskOptions?)""/>
331331
public static Task<{outputType}> CallMyOrchestratorAsync(
@@ -527,7 +527,7 @@ public static Task<string> MyOrchestrator([OrchestrationTrigger] TaskOrchestrati
527527
}}
528528
529529
/// <summary>
530-
/// Schedules a new instance of the <see cref=""MyNS.MyOrchestrator""/> orchestrator.
530+
/// Schedules a new instance of the <see cref=""MyOrchestrator""/> orchestrator.
531531
/// </summary>
532532
/// <inheritdoc cref=""IOrchestrationSubmitter.ScheduleNewOrchestrationInstanceAsync""/>
533533
public static Task<string> ScheduleNewMyOrchestratorInstanceAsync(
@@ -537,7 +537,7 @@ public static Task<string> ScheduleNewMyOrchestratorInstanceAsync(
537537
}}
538538
539539
/// <summary>
540-
/// Calls the <see cref=""MyNS.MyOrchestrator""/> sub-orchestrator.
540+
/// Calls the <see cref=""MyOrchestrator""/> sub-orchestrator.
541541
/// </summary>
542542
/// <inheritdoc cref=""TaskOrchestrationContext.CallSubOrchestratorAsync(TaskName, object?, TaskOptions?)""/>
543543
public static Task<string> CallMyOrchestratorAsync(
@@ -547,7 +547,7 @@ public static Task<string> CallMyOrchestratorAsync(
547547
}}
548548
549549
/// <summary>
550-
/// Calls the <see cref=""MyNS.MyActivity""/> activity.
550+
/// Calls the <see cref=""MyActivity""/> activity.
551551
/// </summary>
552552
/// <inheritdoc cref=""TaskOrchestrationContext.CallActivityAsync(TaskName, object?, TaskOptions?)""/>
553553
public static Task<string> CallMyActivityAsync(this TaskOrchestrationContext ctx, int input, TaskOptions? options = null)

test/Generators.Tests/ClassBasedSyntaxTests.cs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -228,18 +228,24 @@ class MyActivityImpl : TaskActivity<MyClass, MyClass>
228228
public class MyClass { }
229229
}";
230230

231-
string expectedOutput = TestHelpers.WrapAndFormat(
232-
GeneratedClassName,
233-
methodList: @"
234-
/// <summary>
235-
/// Calls the <see cref=""MyNS.MyActivityImpl""/> activity.
236-
/// </summary>
237-
/// <inheritdoc cref=""TaskOrchestrationContext.CallActivityAsync(TaskName, object?, TaskOptions?)""/>
238-
public static Task<MyNS.MyClass> CallMyActivityAsync(this TaskOrchestrationContext ctx, MyNS.MyClass input, TaskOptions? options = null)
231+
string expectedOutput = @"
232+
// <auto-generated/>
233+
#nullable enable
234+
235+
using System;
236+
using System.Threading.Tasks;
237+
using Microsoft.DurableTask;
238+
using Microsoft.DurableTask.Internal;
239+
240+
namespace MyNS
239241
{
240242
public static class GeneratedDurableTaskExtensions
241243
{
242244
245+
/// <summary>
246+
/// Calls the <see cref=""MyActivityImpl""/> activity.
247+
/// </summary>
248+
/// <inheritdoc cref=""TaskOrchestrationContext.CallActivityAsync(TaskName, object?, TaskOptions?)""/>
243249
public static Task<MyClass> CallMyActivityAsync(this TaskOrchestrationContext ctx, MyClass input, TaskOptions? options = null)
244250
{
245251
return ctx.CallActivityAsync<MyClass>(""MyActivity"", input, options);

0 commit comments

Comments
 (0)