Skip to content

Instantly share code, notes, and snippets.

@erjjones
Created June 29, 2015 00:41

Revisions

  1. erjjones created this gist Jun 29, 2015.
    17 changes: 17 additions & 0 deletions odatahq-store-data-then-delete-sample
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    // Create a session for the workspace specified in the configuration.
    using (var session = new WorkspaceSession(configuration))
    {
    // We'll authenticate using standard workspace token authentication with an example user.
    await session.AuthenticateAsync("{username}", "{password}");

    var anonymousDocument = new AnonymousCollection
    {
    DocumentID = Guid.NewGuid().ToString(),
    Name = "Example Inserted Document"
    };

    var result = await session.InsertDocumentAsync(anonymousDocument);

    // Lets clean-up the document we created.
    await session.DeleteDocumentAsync<AnonymousCollection>(anonymousDocument.DocumentID);
    }