.Insert<T>()

Inserts one or multiple records in the database.

Method Syntax

await db.Insert<T>(table, data)

Arguments

ArgumentsDescription
table Optionally pass along a table to insert into.
data Either a single document/record or an array of documents/records to insert
cancellationToken The cancellationToken enables graceful cancellation of asynchronous operations.

Example usage

var posts = new List<Post>
{
new Post
{
Id = ("post", "First"),
Title = "An article",
Content = "This is the first article"
},
new Post
{
Id = ("post", "Second"),
Title = "An article",
Content = "This is the second article"
}
};

await db.Insert("post", posts);