Skip to content

Calling Async C# Method #654

Answered by ClearScriptLib
charles-slc asked this question in Q&A
Discussion options

You must be logged in to vote

That ended up with results in the C# method being null...

To get data back from PutItemAsync, you need to set up a PutItemOperationConfig. For example:

engine.AddHostObject("DynamoClient", client);
engine.AddHostType("DynamoTable", typeof(Table));
engine.AddHostType("DynamoDocument", typeof(Document));
engine.AddHostType("DynamoPutItemOperationConfig", typeof(PutItemOperationConfig));
engine.AddHostType("DynamoReturnValues", typeof(ReturnValues));
engine.Execute(@"
    async function PostDDB() {
        const table = DynamoTable.LoadTable(DynamoClient, 'HelloWorldTable');
        const itemJson = JSON.stringify(data);
        const docItem = DynamoDocument.FromJson(itemJson);
        co…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@charles-slc
Comment options

@ClearScriptLib
Comment options

Answer selected by charles-slc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants