AWS code-library documentation change
Summary
Added C# dependency injection example for DynamoDB client
Security assessment
This is a code structure improvement showing dependency injection patterns. No security-related changes or vulnerabilities are addressed in the code snippet.
Diff
diff --git a/code-library/latest/ug/csharp_4_dynamodb_code_examples.md b/code-library/latest/ug/csharp_4_dynamodb_code_examples.md index bc9dd2ee8..d1e9391ba 100644 --- a//code-library/latest/ug/csharp_4_dynamodb_code_examples.md +++ b//code-library/latest/ug/csharp_4_dynamodb_code_examples.md @@ -356,0 +357,29 @@ There's more on GitHub. Find the complete example and learn how to set up and ru +Use the injected client for table operations. + + + using System.Text.Json; + using Amazon.DynamoDBv2; + using Amazon.DynamoDBv2.DataModel; + using Amazon.DynamoDBv2.DocumentModel; + using Amazon.DynamoDBv2.Model; + + namespace DynamoDBActions; + + /// <summary> + /// Methods of this class perform Amazon DynamoDB operations. + /// </summary> + public class DynamoDbWrapper + { + private readonly IAmazonDynamoDB _amazonDynamoDB; + + /// <summary> + /// Constructor for the DynamoDbWrapper class. + /// </summary> + /// <param name="amazonDynamoDB">The injected DynamoDB client.</param> + public DynamoDbWrapper(IAmazonDynamoDB amazonDynamoDB) + { + _amazonDynamoDB = amazonDynamoDB; + } + + +