Skip to content

Commit

Permalink
Add using statements
Browse files Browse the repository at this point in the history
  • Loading branch information
peterrsongg committed Nov 5, 2024
1 parent cc11015 commit 381c518
Show file tree
Hide file tree
Showing 22 changed files with 96 additions and 95 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -241,17 +241,18 @@ public IRequest Marshall(AmazonWebServiceRequest input)
#line default
#line hidden
this.Write(@"#if !NETCOREAPP3_1_OR_GREATER
MemoryStream memoryStream = new MemoryStream();
using var memoryStream = new MemoryStream();
#endif
#if NETCOREAPP3_1_OR_GREATER
ArrayBufferWriter<byte> arrayBufferWriter = new ArrayBufferWriter<byte>();
Utf8JsonWriter writer = new Utf8JsonWriter(arrayBufferWriter);
using Utf8JsonWriter writer = new Utf8JsonWriter(arrayBufferWriter);
#else
Utf8JsonWriter writer = new Utf8JsonWriter(memoryStream);
using Utf8JsonWriter writer = new Utf8JsonWriter(memoryStream);
#endif
");

#line 105 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCRequestMarshaller.tt"
#line 106 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCRequestMarshaller.tt"

if (shouldMarshallPayload)
{
Expand All @@ -261,7 +262,7 @@ public IRequest Marshall(AmazonWebServiceRequest input)
#line hidden
this.Write("\t\t\tvar context = new JsonMarshallerContext(request, writer);\r\n");

#line 110 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCRequestMarshaller.tt"
#line 111 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCRequestMarshaller.tt"

ProcessStructure(0, "publicRequest." + payload.PropertyName, payload.Shape);

Expand All @@ -270,7 +271,7 @@ public IRequest Marshall(AmazonWebServiceRequest input)
#line hidden
this.Write("\t\t\twriter.Flush();\r\n");

#line 114 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCRequestMarshaller.tt"
#line 115 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCRequestMarshaller.tt"

}
else
Expand All @@ -282,7 +283,7 @@ public IRequest Marshall(AmazonWebServiceRequest input)
this.Write("\t\t\twriter.WriteStartObject();\r\n\t\t\tvar context = new JsonMarshallerContext(request" +
", writer);\r\n");

#line 121 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCRequestMarshaller.tt"
#line 122 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCRequestMarshaller.tt"

ProcessMembers(0, "publicRequest", this.Operation.RequestBodyMembers);

Expand All @@ -291,16 +292,16 @@ public IRequest Marshall(AmazonWebServiceRequest input)
#line hidden
this.Write("\t\t\twriter.WriteEndObject();\r\n\t\t\twriter.Flush();\r\n");

#line 126 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCRequestMarshaller.tt"
#line 127 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCRequestMarshaller.tt"

}


#line default
#line hidden
this.Write("#if !NETCOREAPP3_1_OR_GREATER\r\n\t\t\trequest.Content = memoryStream.ToArray();\r\n\t\t\tm" +
"emoryStream.Dispose();\r\n#else\r\n request.Content = arrayBufferWriter.W" +
"rittenMemory.ToArray();\r\n#endif\r\n");
this.Write("#if !NETCOREAPP3_1_OR_GREATER\r\n\t\t\trequest.Content = memoryStream.ToArray();\r\n#els" +
"e\r\n request.Content = arrayBufferWriter.WrittenMemory.ToArray();\r\n#en" +
"dif\r\n");

#line 135 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCRequestMarshaller.tt"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,14 @@ namespace <#=this.Config.Namespace #>.Model.Internal.MarshallTransformations
{
#>
#if !NETCOREAPP3_1_OR_GREATER
MemoryStream memoryStream = new MemoryStream();

using var memoryStream = new MemoryStream();
#endif
#if NETCOREAPP3_1_OR_GREATER
ArrayBufferWriter<byte> arrayBufferWriter = new ArrayBufferWriter<byte>();
Utf8JsonWriter writer = new Utf8JsonWriter(arrayBufferWriter);
using Utf8JsonWriter writer = new Utf8JsonWriter(arrayBufferWriter);
#else
Utf8JsonWriter writer = new Utf8JsonWriter(memoryStream);
using Utf8JsonWriter writer = new Utf8JsonWriter(memoryStream);
#endif
<#
if (shouldMarshallPayload)
Expand Down Expand Up @@ -128,7 +129,6 @@ namespace <#=this.Config.Namespace #>.Model.Internal.MarshallTransformations
#>
#if !NETCOREAPP3_1_OR_GREATER
request.Content = memoryStream.ToArray();
memoryStream.Dispose();
#else
request.Content = arrayBufferWriter.WrittenMemory.ToArray();
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,14 @@ public IRequest Marshall(DocumentTypeAsMapValueRequest publicRequest)

request.ResourcePath = "/DocumentTypeAsMapValue";
#if !NETCOREAPP3_1_OR_GREATER
MemoryStream memoryStream = new MemoryStream();

using var memoryStream = new MemoryStream();
#endif
#if NETCOREAPP3_1_OR_GREATER
ArrayBufferWriter<byte> arrayBufferWriter = new ArrayBufferWriter<byte>();
Utf8JsonWriter writer = new Utf8JsonWriter(arrayBufferWriter);
using Utf8JsonWriter writer = new Utf8JsonWriter(arrayBufferWriter);
#else
Utf8JsonWriter writer = new Utf8JsonWriter(memoryStream);
using Utf8JsonWriter writer = new Utf8JsonWriter(memoryStream);
#endif
writer.WriteStartObject();
var context = new JsonMarshallerContext(request, writer);
Expand All @@ -90,7 +91,6 @@ public IRequest Marshall(DocumentTypeAsMapValueRequest publicRequest)
writer.Flush();
#if !NETCOREAPP3_1_OR_GREATER
request.Content = memoryStream.ToArray();
memoryStream.Dispose();
#else
request.Content = arrayBufferWriter.WrittenMemory.ToArray();
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,20 +62,20 @@ public IRequest Marshall(DocumentTypeAsPayloadRequest publicRequest)

request.ResourcePath = "/DocumentTypeAsPayload";
#if !NETCOREAPP3_1_OR_GREATER
MemoryStream memoryStream = new MemoryStream();

using var memoryStream = new MemoryStream();
#endif
#if NETCOREAPP3_1_OR_GREATER
ArrayBufferWriter<byte> arrayBufferWriter = new ArrayBufferWriter<byte>();
Utf8JsonWriter writer = new Utf8JsonWriter(arrayBufferWriter);
using Utf8JsonWriter writer = new Utf8JsonWriter(arrayBufferWriter);
#else
Utf8JsonWriter writer = new Utf8JsonWriter(memoryStream);
using Utf8JsonWriter writer = new Utf8JsonWriter(memoryStream);
#endif
var context = new JsonMarshallerContext(request, writer);
Amazon.Runtime.Documents.Internal.Transform.DocumentMarshaller.Instance.Write(context.Writer, publicRequest.DocumentValue);
writer.Flush();
#if !NETCOREAPP3_1_OR_GREATER
request.Content = memoryStream.ToArray();
memoryStream.Dispose();
#else
request.Content = arrayBufferWriter.WrittenMemory.ToArray();
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,14 @@ public IRequest Marshall(DocumentTypeRequest publicRequest)

request.ResourcePath = "/DocumentType";
#if !NETCOREAPP3_1_OR_GREATER
MemoryStream memoryStream = new MemoryStream();

using var memoryStream = new MemoryStream();
#endif
#if NETCOREAPP3_1_OR_GREATER
ArrayBufferWriter<byte> arrayBufferWriter = new ArrayBufferWriter<byte>();
Utf8JsonWriter writer = new Utf8JsonWriter(arrayBufferWriter);
using Utf8JsonWriter writer = new Utf8JsonWriter(arrayBufferWriter);
#else
Utf8JsonWriter writer = new Utf8JsonWriter(memoryStream);
using Utf8JsonWriter writer = new Utf8JsonWriter(memoryStream);
#endif
writer.WriteStartObject();
var context = new JsonMarshallerContext(request, writer);
Expand All @@ -88,7 +89,6 @@ public IRequest Marshall(DocumentTypeRequest publicRequest)
writer.Flush();
#if !NETCOREAPP3_1_OR_GREATER
request.Content = memoryStream.ToArray();
memoryStream.Dispose();
#else
request.Content = arrayBufferWriter.WrittenMemory.ToArray();
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,14 @@ public IRequest Marshall(EndpointWithHostLabelOperationRequest publicRequest)

request.ResourcePath = "/EndpointWithHostLabelOperation";
#if !NETCOREAPP3_1_OR_GREATER
MemoryStream memoryStream = new MemoryStream();

using var memoryStream = new MemoryStream();
#endif
#if NETCOREAPP3_1_OR_GREATER
ArrayBufferWriter<byte> arrayBufferWriter = new ArrayBufferWriter<byte>();
Utf8JsonWriter writer = new Utf8JsonWriter(arrayBufferWriter);
using Utf8JsonWriter writer = new Utf8JsonWriter(arrayBufferWriter);
#else
Utf8JsonWriter writer = new Utf8JsonWriter(memoryStream);
using Utf8JsonWriter writer = new Utf8JsonWriter(memoryStream);
#endif
writer.WriteStartObject();
var context = new JsonMarshallerContext(request, writer);
Expand All @@ -82,7 +83,6 @@ public IRequest Marshall(EndpointWithHostLabelOperationRequest publicRequest)
writer.Flush();
#if !NETCOREAPP3_1_OR_GREATER
request.Content = memoryStream.ToArray();
memoryStream.Dispose();
#else
request.Content = arrayBufferWriter.WrittenMemory.ToArray();
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,14 @@ public IRequest Marshall(HttpChecksumRequiredRequest publicRequest)

request.ResourcePath = "/HttpChecksumRequired";
#if !NETCOREAPP3_1_OR_GREATER
MemoryStream memoryStream = new MemoryStream();

using var memoryStream = new MemoryStream();
#endif
#if NETCOREAPP3_1_OR_GREATER
ArrayBufferWriter<byte> arrayBufferWriter = new ArrayBufferWriter<byte>();
Utf8JsonWriter writer = new Utf8JsonWriter(arrayBufferWriter);
using Utf8JsonWriter writer = new Utf8JsonWriter(arrayBufferWriter);
#else
Utf8JsonWriter writer = new Utf8JsonWriter(memoryStream);
using Utf8JsonWriter writer = new Utf8JsonWriter(memoryStream);
#endif
writer.WriteStartObject();
var context = new JsonMarshallerContext(request, writer);
Expand All @@ -82,7 +83,6 @@ public IRequest Marshall(HttpChecksumRequiredRequest publicRequest)
writer.Flush();
#if !NETCOREAPP3_1_OR_GREATER
request.Content = memoryStream.ToArray();
memoryStream.Dispose();
#else
request.Content = arrayBufferWriter.WrittenMemory.ToArray();
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,14 @@ public IRequest Marshall(HttpPayloadWithStructureRequest publicRequest)

request.ResourcePath = "/HttpPayloadWithStructure";
#if !NETCOREAPP3_1_OR_GREATER
MemoryStream memoryStream = new MemoryStream();

using var memoryStream = new MemoryStream();
#endif
#if NETCOREAPP3_1_OR_GREATER
ArrayBufferWriter<byte> arrayBufferWriter = new ArrayBufferWriter<byte>();
Utf8JsonWriter writer = new Utf8JsonWriter(arrayBufferWriter);
using Utf8JsonWriter writer = new Utf8JsonWriter(arrayBufferWriter);
#else
Utf8JsonWriter writer = new Utf8JsonWriter(memoryStream);
using Utf8JsonWriter writer = new Utf8JsonWriter(memoryStream);
#endif
var context = new JsonMarshallerContext(request, writer);
context.Writer.WriteStartObject();
Expand All @@ -80,7 +81,6 @@ public IRequest Marshall(HttpPayloadWithStructureRequest publicRequest)
writer.Flush();
#if !NETCOREAPP3_1_OR_GREATER
request.Content = memoryStream.ToArray();
memoryStream.Dispose();
#else
request.Content = arrayBufferWriter.WrittenMemory.ToArray();
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,14 @@ public IRequest Marshall(HttpPayloadWithUnionRequest publicRequest)

request.ResourcePath = "/HttpPayloadWithUnion";
#if !NETCOREAPP3_1_OR_GREATER
MemoryStream memoryStream = new MemoryStream();

using var memoryStream = new MemoryStream();
#endif
#if NETCOREAPP3_1_OR_GREATER
ArrayBufferWriter<byte> arrayBufferWriter = new ArrayBufferWriter<byte>();
Utf8JsonWriter writer = new Utf8JsonWriter(arrayBufferWriter);
using Utf8JsonWriter writer = new Utf8JsonWriter(arrayBufferWriter);
#else
Utf8JsonWriter writer = new Utf8JsonWriter(memoryStream);
using Utf8JsonWriter writer = new Utf8JsonWriter(memoryStream);
#endif
var context = new JsonMarshallerContext(request, writer);
context.Writer.WriteStartObject();
Expand All @@ -80,7 +81,6 @@ public IRequest Marshall(HttpPayloadWithUnionRequest publicRequest)
writer.Flush();
#if !NETCOREAPP3_1_OR_GREATER
request.Content = memoryStream.ToArray();
memoryStream.Dispose();
#else
request.Content = arrayBufferWriter.WrittenMemory.ToArray();
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,14 @@ public IRequest Marshall(JsonBlobsRequest publicRequest)

request.ResourcePath = "/JsonBlobs";
#if !NETCOREAPP3_1_OR_GREATER
MemoryStream memoryStream = new MemoryStream();

using var memoryStream = new MemoryStream();
#endif
#if NETCOREAPP3_1_OR_GREATER
ArrayBufferWriter<byte> arrayBufferWriter = new ArrayBufferWriter<byte>();
Utf8JsonWriter writer = new Utf8JsonWriter(arrayBufferWriter);
using Utf8JsonWriter writer = new Utf8JsonWriter(arrayBufferWriter);
#else
Utf8JsonWriter writer = new Utf8JsonWriter(memoryStream);
using Utf8JsonWriter writer = new Utf8JsonWriter(memoryStream);
#endif
writer.WriteStartObject();
var context = new JsonMarshallerContext(request, writer);
Expand All @@ -82,7 +83,6 @@ public IRequest Marshall(JsonBlobsRequest publicRequest)
writer.Flush();
#if !NETCOREAPP3_1_OR_GREATER
request.Content = memoryStream.ToArray();
memoryStream.Dispose();
#else
request.Content = arrayBufferWriter.WrittenMemory.ToArray();
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,14 @@ public IRequest Marshall(JsonEnumsRequest publicRequest)

request.ResourcePath = "/JsonEnums";
#if !NETCOREAPP3_1_OR_GREATER
MemoryStream memoryStream = new MemoryStream();

using var memoryStream = new MemoryStream();
#endif
#if NETCOREAPP3_1_OR_GREATER
ArrayBufferWriter<byte> arrayBufferWriter = new ArrayBufferWriter<byte>();
Utf8JsonWriter writer = new Utf8JsonWriter(arrayBufferWriter);
using Utf8JsonWriter writer = new Utf8JsonWriter(arrayBufferWriter);
#else
Utf8JsonWriter writer = new Utf8JsonWriter(memoryStream);
using Utf8JsonWriter writer = new Utf8JsonWriter(memoryStream);
#endif
writer.WriteStartObject();
var context = new JsonMarshallerContext(request, writer);
Expand Down Expand Up @@ -130,7 +131,6 @@ public IRequest Marshall(JsonEnumsRequest publicRequest)
writer.Flush();
#if !NETCOREAPP3_1_OR_GREATER
request.Content = memoryStream.ToArray();
memoryStream.Dispose();
#else
request.Content = arrayBufferWriter.WrittenMemory.ToArray();
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,14 @@ public IRequest Marshall(JsonIntEnumsRequest publicRequest)

request.ResourcePath = "/JsonIntEnums";
#if !NETCOREAPP3_1_OR_GREATER
MemoryStream memoryStream = new MemoryStream();

using var memoryStream = new MemoryStream();
#endif
#if NETCOREAPP3_1_OR_GREATER
ArrayBufferWriter<byte> arrayBufferWriter = new ArrayBufferWriter<byte>();
Utf8JsonWriter writer = new Utf8JsonWriter(arrayBufferWriter);
using Utf8JsonWriter writer = new Utf8JsonWriter(arrayBufferWriter);
#else
Utf8JsonWriter writer = new Utf8JsonWriter(memoryStream);
using Utf8JsonWriter writer = new Utf8JsonWriter(memoryStream);
#endif
writer.WriteStartObject();
var context = new JsonMarshallerContext(request, writer);
Expand Down Expand Up @@ -130,7 +131,6 @@ public IRequest Marshall(JsonIntEnumsRequest publicRequest)
writer.Flush();
#if !NETCOREAPP3_1_OR_GREATER
request.Content = memoryStream.ToArray();
memoryStream.Dispose();
#else
request.Content = arrayBufferWriter.WrittenMemory.ToArray();
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,14 @@ public IRequest Marshall(JsonListsRequest publicRequest)

request.ResourcePath = "/JsonLists";
#if !NETCOREAPP3_1_OR_GREATER
MemoryStream memoryStream = new MemoryStream();

using var memoryStream = new MemoryStream();
#endif
#if NETCOREAPP3_1_OR_GREATER
ArrayBufferWriter<byte> arrayBufferWriter = new ArrayBufferWriter<byte>();
Utf8JsonWriter writer = new Utf8JsonWriter(arrayBufferWriter);
using Utf8JsonWriter writer = new Utf8JsonWriter(arrayBufferWriter);
#else
Utf8JsonWriter writer = new Utf8JsonWriter(memoryStream);
using Utf8JsonWriter writer = new Utf8JsonWriter(memoryStream);
#endif
writer.WriteStartObject();
var context = new JsonMarshallerContext(request, writer);
Expand Down Expand Up @@ -185,7 +186,6 @@ public IRequest Marshall(JsonListsRequest publicRequest)
writer.Flush();
#if !NETCOREAPP3_1_OR_GREATER
request.Content = memoryStream.ToArray();
memoryStream.Dispose();
#else
request.Content = arrayBufferWriter.WrittenMemory.ToArray();
#endif
Expand Down
Loading

0 comments on commit 381c518

Please sign in to comment.