Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow custom converters to access ToDocument and ToEntity (like existing internal methods) #258

Open
bbdaniell opened this issue Oct 21, 2024 · 1 comment
Assignees

Comments

@bbdaniell
Copy link

The problem we're trying to solve is having a converter that allows us to serialize & deserialize derived classes. We currently have a working solution based on this approach, but we've run into some limitations.

We don't want to have to write a custom converter for each subtype, because the types are relatively so like in the linked example we rely on an injected DynamoDbContext.ToEntity<T> to convert each subtype. But we'd like to be able to register the converter for the type on the class property or context like the documentation.

It seems like it should be possible by registering a DdbConverterFactory, but there's no obvious way to go from DynamoDbContextMetadata to a DynamoDbContext. These extension methods also look like they would work, which I think is how the internal ObjectDdbConverter class works, but I don't know what the implications of using those elsewhere would be.

If there's a better way to do what we're trying to do I'd be glad to hear it!

@firenero
Copy link
Contributor

Hey @bbdaniell, sorry but I'm not really following what are you trying to achieve and why can't you implicitly use the ObjectDdbConverter. Do you mind writing some code examples of what you're trying to achieve so I can think of alternative solution and/or changes required to the library API?

@firenero firenero self-assigned this Oct 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants