.Create<T>()
Creates a record in the database.
Method Syntax
await db.Create<T>(resource, data)
Arguments
| Arguments | Description |
|---|
thing required | The table name or a RecordId to create. |
data optional | The document / record data to insert. |
cancellationToken optional | The cancellationToken enables graceful cancellation of asynchronous operations. |
Example usage
var person = await db.Create<Person>("person");
var person = await db.Create("person", new Person { Name = "Tobie" });
var personToCreate = new Person
{
Id = ("person", "tobie"),
Name = "Tobie",
Settings = new Settings
{
Active = true,
Marketing = true,
},
};
var result = await db.Create(personToCreate);