Open
Description
Description
Read-only POCO properties are ignored when creating a Document
using IDynamoDBContext.ToDocument
These properties have values and should be included in the produced Document
.
Reproduction Steps
Create a POCO with DynamoDB annotations and a read-only property (Greeting
)
public class MyObject
{
[DynamoDBHashKey("id")]
public string Id { get; set; }
[DynamoDBProperty("name")]
public string Name { get; set; }
[DynamoDBProperty("greeting")]
public string Greeting => $"Hello, {Name}"
}
Create a Document
and inspect the keys / values
var myobj = new MyObject
{
Id = "my-id",
Name = "Phil"
};
Console.WriteLine(myobj.Greeting); // "Hello, Phil"
var context = new DynamoDBContext(ddbclient);
var document = context.ToDocument(myobj);
Console.WriteLine(document.Count); // 2
Console.WriteLine(document.Keys.Contains("id")); // true
Console.WriteLine(document.Keys.Contains("name")); // true
Console.WriteLine(document.Keys.Contains("greeting")); // false
Environment
- SDK Version: AWSSDK.DynamoDBv2 3.3.106.36
- OS Info: Windows 10
- Build Environment: Jetbrains Rider and
dotnet
CLI - Targeted .NET Platform: .Net Core 3.1
This is a 🐛 bug-report