For AI agents: the documentation index is at llms.txt. Guide pages have a markdown version at the same path with .md appended, before any query string or fragment.
Performs an INSERT into the table.
NULL.[Column] sets NullValueHandling = JsonIgnoreCondition.WhenWritingNull and its value is null. Without that setting, a null value is always written.MissingFields = QueryOptions.MissingFieldType.ColumnDefault. A value you set to null on a property that is always written stays null.[Table("cities")]
class City : BaseModel
{
[PrimaryKey("id", false)]
public int Id { get; set; }
[Column("name")]
public string Name { get; set; }
[Column("country_id")]
public int CountryId { get; set; }
}
var model = new City
{
Name = "The Shire",
CountryId = 554
};
await supabase.From<City>().Insert(model);
[Table("cities")]
class City : BaseModel
{
[PrimaryKey("id", false)]
public int Id { get; set; }
[Column("name")]
public string Name { get; set; }
[Column("country_id")]
public int CountryId { get; set; }
}
var models = new List<City>
{
new City { Name = "The Shire", CountryId = 554 },
new City { Name = "Rohan", CountryId = 553 },
};
await supabase.From<City>().Insert(models);
var result = await supabase
.From<City>()
.Insert(models, new QueryOptions { Returning = ReturnType.Representation });
[Table("cities")]
class City : BaseModel
{
[PrimaryKey("id", false)]
public int Id { get; set; }
[Column("name")]
public string? Name { get; set; }
[Column("population", NullValueHandling = JsonIgnoreCondition.WhenWritingNull)]
public int? Population { get; set; }
}
var rows = new List<City>
{
new City { Id = 1, Name = "The Shire" },
new City { Id = 2, Name = "Rivendell", Population = 1200 }
};
await supabase.From<City>().Insert(rows, new QueryOptions
{
MissingFields = QueryOptions.MissingFieldType.ColumnDefault
});