Skip to content

Commit 0758a92

Browse files
a minor refactor on mgmt plane code (#3149)
1 parent 936d073 commit 0758a92

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/AutoRest.CSharp/Mgmt/Generation/MgmtClientBaseWriter.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -506,9 +506,6 @@ protected virtual void WriteMethod(MgmtClientOperation clientOperation, bool isA
506506
protected Dictionary<string, WriteMethodDelegate> _customMethods = new Dictionary<string, WriteMethodDelegate>();
507507
private WriteMethodDelegate GetMethodDelegate(MgmtClientOperation clientOperation)
508508
{
509-
if (clientOperation.IsLongRunningOperation && clientOperation.IsPagingOperation)
510-
throw new NotImplementedException($"Pageable LRO is not implemented yet, please use `remove-operation` directive to remove the following operationIds: {string.Join(", ", clientOperation.Select(o => o.OperationId))}");
511-
512509
if (!_customMethods.TryGetValue($"Write{clientOperation.Name}Body", out var function))
513510
{
514511
function = GetMethodDelegate(clientOperation.IsLongRunningOperation, clientOperation.IsPagingOperation);
@@ -523,9 +520,14 @@ protected virtual WriteMethodDelegate GetMethodDelegate(bool isLongRunning, bool
523520
(true, false) => WriteLROMethodBody,
524521
(false, true) => WritePagingMethodBody,
525522
(false, false) => WriteNormalMethodBody,
526-
_ => throw new InvalidOperationException("Unknown method combination"),
523+
(true, true) => WritePagingLROMethodBody,
527524
};
528525

526+
private void WritePagingLROMethodBody(MgmtClientOperation clientOperation, Diagnostic diagnostic, bool isAsync)
527+
{
528+
throw new NotImplementedException($"Pageable LRO is not implemented yet, please use `remove-operation` directive to remove the following operationIds: {string.Join(", ", clientOperation.Select(o => o.OperationId))}");
529+
}
530+
529531
protected IDisposable WriteCommonMethod(MgmtClientOperation clientOperation, bool isAsync)
530532
{
531533
_writer.Line();

0 commit comments

Comments
 (0)