Esempio n. 1
0
        /// <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());
        }
Esempio n. 2
0
        /// <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());
        }
Esempio n. 3
0
        /// <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());
        }
Esempio n. 4
0
        /// <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());
        }
Esempio n. 5
0
        /// <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);
        }
Esempio n. 6
0
        /// <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);
        }
Esempio n. 7
0
        /// <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);
        }
Esempio n. 8
0
 /// <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;
Esempio n. 9
0
 /// <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;
Esempio n. 10
0
 /// <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;
Esempio n. 11
0
 /// <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;