EfficientDynamoDb
EfficientDynamoDb copied to clipboard
Batch.PutItem and friends to accept, Type and object. Also for single entity operations
In order to make some complex repositories, It would be great to be able to call Put, Delete and other methods with Type and object.
Under the hood, the library is making typeof(TEntity)
and casting intance to object
Example
public static IBatchPutItemBuilder PutItem<TEntity>(TEntity entity) where TEntity : class => (IBatchPutItemBuilder) new BatchPutItemBuilder(typeof (TEntity), (object) entity);
If we add a new method signature like PutItem(object o, Type t) we could play better with reflection scenarios.
What do you think?
Hey @wjax,
We didn't plan to expose this API because it might be confusing and not really popular. Could you explain more about your use case? We could try find a solution without exposing such APIs
The intention is to add Single table design extensions.
So I came up with some annotations and "magic" that allows to create single table design with some out of the box relationsships management in a very transparent manner.
For that to work, I need to use reflection (with as many caching as possible) and so I need to call efficient dynamo lib with runtime types
Sorry for the long delay.
You can use reflection to call the generic methods with runtime types. Quick search shows this SO question with examples: https://stackoverflow.com/questions/232535/how-do-i-use-reflection-to-call-a-generic-method
Closing this one because there is no changes required to the library. Feel free to reopen this issue if you have additional info to the original issue.