From 6b4c5a52a39bf7ad2c946461b61392cab45891c8 Mon Sep 17 00:00:00 2001 From: inputfalken Date: Wed, 30 Aug 2023 21:01:52 +0200 Subject: [PATCH] Add sample with supported attributes --- README.md | 10 +++++++++- SampleApp/Program.cs | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 26eec407..353e3b65 100644 --- a/README.md +++ b/README.md @@ -108,8 +108,16 @@ internal static class Program public class Person { + // Will be included as 'Firstname' in DynamoDB. public string Firstname { get; set; } + + // Will be included as 'Contact' in DynamoDB. + [DynamoDBProperty("Contact")] public Contact ContactInfo { get; set; } + + // Wont be included in DynamoDB. + [DynamoDBIgnore] + public string FirstNameLowercase => Firstname.ToLower(); public class Contact { @@ -117,7 +125,7 @@ public class Person } } // This DynamoDBDocumentAttribute is what will casuse the source generation to kick in. -// The type provided to the DynamoDBDocumentAttribute is what will get functinality. +// The type provided to the DynamoDBDocumentAttribute is what will get functionality. // It is possible to provide multiple DynamoDBDocumentAttributes in order to have multiple types source generated. [DynamoDBDocument(typeof(Person))] public partial class Repository { } diff --git a/SampleApp/Program.cs b/SampleApp/Program.cs index 20f472dc..3e0ed5a6 100644 --- a/SampleApp/Program.cs +++ b/SampleApp/Program.cs @@ -76,6 +76,7 @@ public PutItemRequest PutByAws() [Benchmark] public PutItemRequest PutBySourceGeneration() { + [DynamoDBIgnore] return _repository.PersonEntityDocument.ToPutItemRequest(_singleElement, "TABLE"); }