コード例 #1
0
        /// <summary>
        ///     Configures the default schema that database objects should be created in, if no schema
        ///     is explicitly configured.
        /// </summary>
        /// <param name="modelBuilder"> The model builder. </param>
        /// <param name="schema"> The default schema. </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,
        ///     <see langword="null" /> otherwise.
        /// </returns>
        public static IConventionModelBuilder HasDefaultSchema(
            [NotNull] this IConventionModelBuilder modelBuilder,
            [CanBeNull] string schema,
            bool fromDataAnnotation = false)
        {
            if (modelBuilder.CanSetDefaultSchema(schema, fromDataAnnotation))
            {
                modelBuilder.Metadata.SetDefaultSchema(schema, fromDataAnnotation);

                return(modelBuilder);
            }

            return(null);
        }