示例#1
0
        /// <summary>
        ///     Removes the <see cref="ICheckConstraint" /> with the given name.
        /// </summary>
        /// <param name="entityType"> The entity type to remove the check constraint from. </param>
        /// <param name="name"> The check constraint name to be removed. </param>
        /// <returns>
        ///     True if the <see cref="ICheckConstraint" /> is successfully found and removed; otherwise, false.
        /// </returns>
        public static bool RemoveCheckConstraint(
            [NotNull] this IMutableEntityType entityType,
            [NotNull] string name)
        {
            Check.NotEmpty(name, nameof(name));

            return(CheckConstraint.RemoveCheckConstraint(entityType, name));
        }
        /// <summary>
        ///     Removes the <see cref="ICheckConstraint" /> with the given name.
        /// </summary>
        /// <param name="model"> The model to remove the check constraint from. </param>
        /// <param name="name"> The check constraint name. </param>
        /// <param name="table"> The table that contains the check constraint. </param>
        /// <param name="schema"> The table schema that contains the check constraint. </param>
        /// <returns>
        ///     The removed <see cref="ICheckConstraint" /> or <c>null</c> if no check constraint with the given name in
        ///     the given schema was found.
        /// </returns>
        public static ICheckConstraint RemoveCheckConstraint(
            [NotNull] this IMutableModel model, [NotNull] string name, [NotNull] string table, [CanBeNull] string schema = null)
        {
            Check.NotEmpty(name, nameof(name));
            Check.NotEmpty(table, nameof(table));
            Check.NullButNotEmpty(schema, nameof(schema));

            return(CheckConstraint.RemoveCheckConstraint(model, name, table, schema));
        }
 /// <summary>
 ///     Removes the <see cref="IConventionCheckConstraint" /> with the given name.
 /// </summary>
 /// <param name="entityType"> The entity type to remove the check constraint from. </param>
 /// <param name="name"> The check constraint name. </param>
 /// <returns> The removed <see cref="IConventionCheckConstraint" />. </returns>
 public static IConventionCheckConstraint RemoveCheckConstraint(
     [NotNull] this IConventionEntityType entityType,
     [NotNull] string name)
 => CheckConstraint.RemoveCheckConstraint((IMutableEntityType)entityType, Check.NotEmpty(name, nameof(name)));
 /// <summary>
 ///     Removes the <see cref="IConventionCheckConstraint" /> with the given name.
 /// </summary>
 /// <param name="entityType">The entity type to remove the check constraint from.</param>
 /// <param name="name">The check constraint name.</param>
 /// <returns>The removed check constraint.</returns>
 public static IConventionCheckConstraint?RemoveCheckConstraint(
     this IConventionEntityType entityType,
     string name)
 => (IConventionCheckConstraint?)CheckConstraint.RemoveCheckConstraint(
     (IMutableEntityType)entityType, Check.NotEmpty(name, nameof(name)));
 /// <summary>
 ///     Removes the <see cref="ICheckConstraint" /> with the given name.
 /// </summary>
 /// <param name="entityType">The entity type to remove the check constraint from.</param>
 /// <param name="name">The check constraint name to be removed.</param>
 /// <returns>The removed check constraint.</returns>
 public static IMutableCheckConstraint?RemoveCheckConstraint(
     this IMutableEntityType entityType,
     string name)
 => CheckConstraint.RemoveCheckConstraint(entityType, Check.NotEmpty(name, nameof(name)));