Пример #1
0
        /// <summary>
        ///     Configures the provisioned throughput.
        /// </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="throughput">The throughput to set.</param>
        /// <param name="autoscale">Whether autoscale is enabled.</param>
        /// <param name="fromDataAnnotation">Indicates whether the configuration was specified using a data annotation.</param>
        public static IConventionEntityTypeBuilder?HasThroughput(
            this IConventionEntityTypeBuilder entityTypeBuilder,
            int?throughput,
            bool autoscale,
            bool fromDataAnnotation = false)
        {
            if (!entityTypeBuilder.CanSetThroughput(throughput, autoscale, fromDataAnnotation))
            {
                return(null);
            }

            entityTypeBuilder.Metadata.SetThroughput(throughput, autoscale, fromDataAnnotation);

            return(entityTypeBuilder);
        }