Search documentationEsc

TimeToLiveItem

A base helper class that implements IItemWithTimeToLive

Namespace: Microsoft.Azure.CosmosRepository
Kind: class

A base helper class that implements IItemWithTimeToLive

public abstract class TimeToLiveItem : Item, IItemWithTimeToLive, IItem

Example

Here is an example subclass item, which adds several properties:

public class SubItem : ItemWithTimeToLive
{
public DateTimeOffset Date { get; set; }
public string Name { get; set; }
public IEnumerable<Child> Children { get; set; }
public IEnumerable<string> Tags { get; set; }
}
public class Child
{
public string Name { get; set; }
public DateTime BirthDate { get; set; }
}

Members

Property

TimeToLiveItem.TimeToLive

The time an item should exist within the container.

When setting this to a positive integer this requires the default TTL at container level to be set to a non-null value.

public TimeSpan? TimeToLive { get; set; }

ReturnsTimeSpan}