コード例 #1
0
        /// <summary>
        ///     <para>
        ///         Attempts to configure the performance level (SERVICE_OBJECTIVE) for Azure SQL Database.
        ///     </para>
        ///     <para>
        ///         Literals should be delimited with ''. See Azure SQL Database documentation for supported values.
        ///     </para>
        /// </summary>
        /// <param name="modelBuilder"> The model builder. </param>
        /// <param name="performanceLevel"> 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 HasPerformanceLevel(
            [NotNull] this IConventionModelBuilder modelBuilder, [CanBeNull] string performanceLevel, bool fromDataAnnotation = false)
        {
            if (modelBuilder.CanSetPerformanceLevel(performanceLevel, fromDataAnnotation))
            {
                modelBuilder.Metadata.SetPerformanceLevel(performanceLevel, fromDataAnnotation);
                return(modelBuilder);
            }

            return(null);
        }