Search code examples
c#servicestack.net-6.0pocodynamo

PocoDynamo not saving child objects with proper Alias or DynamoDbProperty naming


I am working with PocoDynamo and I am having an issue where the child object properties are not being saved with the proper alias attribute name.

public class Doc
{
    [Alias("id")] 
    public Guid Id {get; set;}

    [References(typeof(User))]
    [Alias("userId")] 
    public Guid UserId { get; set; }

    [Alias("specialty")] 
    public string Specialty { get; set; }
}

public class Practice
{
    public Practice()
    {
        Docs = new List<Doc>();            
    }

    [Alias("id")] 
    public Guid Id {get; set;}

    [Reference]
    [Alias("docs")]
    public List<Doc> Docs { get; set; }
}

As you can see in the image, the parent Practice property docs is named correctly. However, the child properties of docs are pascal cased.

enter image description here

I tried using the DynamoDbProperty attribute but ran into the same issue.

When getting a Practice by Id the docs collection is loaded, but the properties are null or default values. It seems when reading child objects the Alias / DynamoDbProperty attributes are honored. It doesn't work when saving.


Solution

  • I've just added support for this feature in this commit.

    This change is available from v6.1.1+ that's now available on MyGet.