/// <summary> /// Configures the default time to live in seconds at container scope. /// </summary> /// <remarks> /// See <see href="https://aka.ms/efcore-docs-modeling">Modeling entity types and relationships</see>, and /// <see href="https://aka.ms/efcore-docs-cosmos">Accessing Azure Cosmos DB with EF Core</see> for more information. /// </remarks> /// <param name="entityTypeBuilder">The builder for the entity type being configured.</param> /// <param name="seconds">The time to live.</param> /// <param name="fromDataAnnotation">Indicates whether the configuration was specified using a data annotation.</param> /// <returns> /// The same builder instance if the configuration was applied, /// <see langword="null" /> otherwise. /// </returns> public static IConventionEntityTypeBuilder?HasDefaultTimeToLive( this IConventionEntityTypeBuilder entityTypeBuilder, int?seconds, bool fromDataAnnotation = false) { if (!entityTypeBuilder.CanSetDefaultTimeToLive(seconds, fromDataAnnotation)) { return(null); } entityTypeBuilder.Metadata.SetDefaultTimeToLive(seconds, fromDataAnnotation); return(entityTypeBuilder); }