@@ -661,7 +661,7 @@ export async function $onEmit(context: EmitContext<CSharpServiceEmitterOptions>)
661661 const multipart : boolean = this . #isMultipartRequest( httpOperation ) ;
662662 const declParams = ! multipart
663663 ? this . #emitHttpOperationParameters( httpOperation )
664- : this . #emitHttpOperationParameters( httpOperation , "HttpRequest request, Stream body" ) ;
664+ : this . #emitHttpOperationParameters( httpOperation , true ) ;
665665
666666 if ( multipart ) {
667667 const context = this . emitter . getContext ( ) ;
@@ -720,14 +720,14 @@ export async function $onEmit(context: EmitContext<CSharpServiceEmitterOptions>)
720720 ${ this . emitter . emitOperationReturnType ( operation ) }
721721 public virtual async Task<IActionResult> ${ operationName } (${ declParams } )
722722 {
723- var boundary = request .GetMultipartBoundary();
723+ var boundary = Request .GetMultipartBoundary();
724724 if (boundary == null)
725725 {
726726 return BadRequest("Request missing multipart boundary");
727727 }
728728
729729
730- var reader = new MultipartReader(boundary, body );
730+ var reader = new MultipartReader(boundary, Request.Body );
731731 ${
732732 hasResponseValue
733733 ? `var result = await ${ this . emitter . getContext ( ) . resourceName } Impl.${ operationName } Async(${ this . #emitOperationCallParameters( httpOperation , "reader" ) } );
@@ -912,7 +912,7 @@ export async function $onEmit(context: EmitContext<CSharpServiceEmitterOptions>)
912912
913913 #emitHttpOperationParameters(
914914 operation : HttpOperation ,
915- bodyParameter ?: string ,
915+ bodyParameter ?: boolean ,
916916 ) : EmitterOutput < string > {
917917 const signature = new StringBuilder ( ) ;
918918 const bodyParam = operation . parameters . body ;
@@ -930,10 +930,16 @@ export async function $onEmit(context: EmitContext<CSharpServiceEmitterOptions>)
930930 for ( const parameter of requiredParams ) {
931931 signature . push (
932932 code `${ this . #emitOperationSignatureParameter( operation , parameter ) } ${
933- ++ i < requiredParams . length || bodyParam !== undefined ? ", " : ""
933+ ++ i < requiredParams . length ? ", " : ""
934934 } `,
935935 ) ;
936936 }
937+ if (
938+ requiredParams . length > 0 &&
939+ ( optionalParams . length > 0 || ( bodyParameter === undefined && bodyParam !== undefined ) )
940+ ) {
941+ signature . push ( code `, ` ) ;
942+ }
937943 if ( bodyParameter === undefined ) {
938944 if ( bodyParam !== undefined ) {
939945 signature . push (
@@ -942,11 +948,9 @@ export async function $onEmit(context: EmitContext<CSharpServiceEmitterOptions>)
942948 bodyParam . type ,
943949 Visibility . Create || Visibility . Update ,
944950 ) ,
945- ) } body${ optionalParams . length > 0 ? ", " : "" } `,
951+ ) } body${ requiredParams . length > 0 && optionalParams . length > 0 ? ", " : "" } `,
946952 ) ;
947953 }
948- } else {
949- signature . push ( code `${ bodyParameter } ${ optionalParams . length > 0 ? ", " : "" } ` ) ;
950954 }
951955 i = 0 ;
952956 for ( const parameter of optionalParams ) {
0 commit comments