Search documentationEsc

Time stamps

Track CreatedTimeUtc, LastUpdatedTimeUtc, and the raw `_ts` for every item.

TimeStampedItem and FullItem add three timestamp properties out of the box:

PropertySourceNotes
CreatedTimeUtcSet by the library on CreateAsyncIf you set it before CreateAsync, the library leaves your value alone. Existing data may have null.
LastUpdatedTimeUtcDerived from Cosmos’s _tsFriendly DateTime.
LastUpdatedTimeRawCosmos’s _tsRaw seconds since epoch.

The _ts property is documented in the official Cosmos DB REST reference — it is automatically maintained on every update.

using Microsoft.Azure.CosmosRepository;
public class AuditEntry : TimeStampedItem
{
public string Action { get; set; } = null!;
public string PerformedBy { get; set; } = null!;
}
var repository = serviceProvider.GetRequiredService<IRepository<AuditEntry>>();
var entry = await repository.CreateAsync(new AuditEntry
{
Action = "DELETE",
PerformedBy = "alice@contoso.com",
});
Console.WriteLine($"Created at {entry.CreatedTimeUtc:O}");
Console.WriteLine($"Last updated at {entry.LastUpdatedTimeUtc:O}");