Пример #1
0
        /// <summary>
        ///     <para>
        ///         Attempts to configure the performance level (SERVICE_OBJECTIVE) for Azure SQL Database.
        ///     </para>
        ///     <para>
        ///         See Azure SQL Database documentation for supported values.
        ///     </para>
        /// </summary>
        /// <param name="modelBuilder"> The model builder. </param>
        /// <param name="performanceLevel"> The expression for the performance level of the database. </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,
        ///     <c>null</c> otherwise.
        /// </returns>
        public static IConventionModelBuilder HasPerformanceLevelSql(
            [NotNull] this IConventionModelBuilder modelBuilder, [CanBeNull] string performanceLevel, bool fromDataAnnotation = false)
        {
            if (modelBuilder.CanSetPerformanceLevelSql(performanceLevel, fromDataAnnotation))
            {
                modelBuilder.Metadata.SetPerformanceLevelSql(performanceLevel, fromDataAnnotation);
                return(modelBuilder);
            }

            return(null);
        }