/// <summary> /// Sets the number of sequence numbers to be preallocated and stored in memory for faster access. /// </summary> /// <param name="property">The property.</param> /// <param name="numbersToCache">The value to set.</param> public static void SetIdentityNumbersToCache([NotNull] this IMutableProperty property, long?numbersToCache) { var options = IdentitySequenceOptionsData.Get(property); options.NumbersToCache = numbersToCache ?? 1; property.SetOrRemoveAnnotation(NpgsqlAnnotationNames.IdentityOptions, options.Serialize()); }
/// <summary> /// Sets whether the identity's sequence is cyclic. /// </summary> /// <param name="property">The property.</param> /// <param name="isCyclic">The value to set.</param> public static void SetIdentityIsCyclic([NotNull] this IMutableProperty property, bool?isCyclic) { var options = IdentitySequenceOptionsData.Get(property); options.IsCyclic = isCyclic ?? false; property.SetOrRemoveAnnotation(NpgsqlAnnotationNames.IdentityOptions, options.Serialize()); }
/// <summary> /// Sets the identity maximum value. /// </summary> /// <param name="property">The property.</param> /// <param name="maxValue">The value to set.</param> public static void SetIdentityMaxValue([NotNull] this IMutableProperty property, long?maxValue) { var options = IdentitySequenceOptionsData.Get(property); options.MaxValue = maxValue; property.SetOrRemoveAnnotation(NpgsqlAnnotationNames.IdentityOptions, options.Serialize()); }
/// <summary> /// Sets the identity increment value. /// </summary> /// <param name="property">The property.</param> /// <param name="incrementBy">The value to set.</param> public static void SetIdentityIncrementBy([NotNull] this IMutableProperty property, long?incrementBy) { var options = IdentitySequenceOptionsData.Get(property); options.IncrementBy = incrementBy ?? 1; property.SetOrRemoveAnnotation(NpgsqlAnnotationNames.IdentityOptions, options.Serialize()); }
/// <summary> /// Sets the number of sequence numbers to be preallocated and stored in memory for faster access. /// </summary> /// <param name="property">The property.</param> /// <param name="numbersToCache">The value to set.</param> /// <param name="fromDataAnnotation">Indicates whether the configuration was specified using a data annotation.</param> public static void SetIdentityNumbersToCache( [NotNull] this IConventionProperty property, long?numbersToCache, bool fromDataAnnotation = false) { var options = IdentitySequenceOptionsData.Get(property); options.NumbersToCache = numbersToCache ?? 1; property.SetOrRemoveAnnotation(NpgsqlAnnotationNames.IdentityOptions, options.Serialize(), fromDataAnnotation); }
/// <summary> /// Sets the identity maximum value. /// </summary> /// <param name="property">The property.</param> /// <param name="maxValue">The value to set.</param> /// <param name="fromDataAnnotation">Indicates whether the configuration was specified using a data annotation.</param> public static void SetIdentityMaxValue( [NotNull] this IConventionProperty property, long?maxValue, bool fromDataAnnotation = false) { var options = IdentitySequenceOptionsData.Get(property); options.MaxValue = maxValue; property.SetOrRemoveAnnotation(NpgsqlAnnotationNames.IdentityOptions, options.Serialize(), fromDataAnnotation); }
/// <summary> /// Sets the identity increment value. /// </summary> /// <param name="property">The property.</param> /// <param name="incrementBy">The value to set.</param> /// <param name="fromDataAnnotation">Indicates whether the configuration was specified using a data annotation.</param> public static void SetIdentityIncrementBy( [NotNull] this IConventionProperty property, long?incrementBy, bool fromDataAnnotation = false) { var options = IdentitySequenceOptionsData.Get(property); options.IncrementBy = incrementBy ?? 1; property.SetOrRemoveAnnotation(NpgsqlAnnotationNames.IdentityOptions, options.Serialize(), fromDataAnnotation); }
/// <summary> /// Returns the number of sequence numbers to be preallocated and stored in memory for faster access. /// Defaults to 1 (no cache). /// </summary> /// <param name="property">The property.</param> /// <returns>The number of sequence numbers to be cached.</returns> public static long?GetIdentityNumbersToCache([NotNull] this IProperty property) => IdentitySequenceOptionsData.Get(property).NumbersToCache;
/// <summary> /// Returns whether the identity's sequence is cyclic. /// </summary> /// <param name="property">The property.</param> /// <returns>Whether the identity's sequence is cyclic.</returns> public static bool?GetIdentityIsCyclic([NotNull] this IProperty property) => IdentitySequenceOptionsData.Get(property).IsCyclic;
/// <summary> /// Returns the identity maximum value. /// </summary> /// <param name="property">The property.</param> /// <returns>The identity maximum value.</returns> public static long?GetIdentityMaxValue([NotNull] this IProperty property) => IdentitySequenceOptionsData.Get(property).MaxValue;
/// <summary> /// Returns the identity increment value. /// </summary> /// <param name="property">The property.</param> /// <returns>The identity increment value.</returns> public static long?GetIdentityIncrementBy([NotNull] this IProperty property) => IdentitySequenceOptionsData.Get(property).IncrementBy;