Skip to content

Commit

Permalink
Add sample with supported attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
inputfalken committed Aug 30, 2023
1 parent 2de8856 commit 6b4c5a5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,24 @@ 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
{
public string Email { get; set;}
}
}
// 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 { }
Expand Down
1 change: 1 addition & 0 deletions SampleApp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public PutItemRequest PutByAws()
[Benchmark]
public PutItemRequest PutBySourceGeneration()
{
[DynamoDBIgnore]

Check failure on line 79 in SampleApp/Program.cs

View workflow job for this annotation

GitHub Actions / build

Attributes are not valid in this context.

Check failure on line 79 in SampleApp/Program.cs

View workflow job for this annotation

GitHub Actions / build

Attributes are not valid in this context.
return _repository.PersonEntityDocument.ToPutItemRequest(_singleElement, "TABLE");
}

Expand Down

0 comments on commit 6b4c5a5

Please sign in to comment.