Пример #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> The removed check constraint. </returns>
 public static IMutableCheckConstraint?RemoveCheckConstraint(
     this IMutableEntityType entityType,
     string name)
 => CheckConstraint.RemoveCheckConstraint(entityType, Check.NotEmpty(name, nameof(name)));
Пример #2
0
 /// <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)));
Пример #3
0
        /// <summary>
        ///     Returns an object that can be used to configure a given entity type in the model.
        ///     If an entity type with the provided name is not already part of the model,
        ///     a new entity type that does not have a corresponding CLR type will be added to the model.
        /// </summary>
        /// <param name="name"> The name of the entity type to be configured. </param>
        /// <returns> An object that can be used to configure the entity type. </returns>
        public virtual EntityTypeBuilder Entity([NotNull] string name)
        {
            Check.NotEmpty(name, nameof(name));

            return(new EntityTypeBuilder(Builder.Entity(name, ConfigurationSource.Explicit).Metadata));
        }
 /// <summary>
 ///     Finds an <see cref="ISequence" /> with the given name.
 /// </summary>
 /// <param name="model"> The model to find the sequence in. </param>
 /// <param name="name"> The sequence name. </param>
 /// <param name="schema"> The schema that contains the sequence. </param>
 /// <returns>
 ///     The <see cref="ISequence" /> or <see langword="null" /> if no sequence with the given name in
 ///     the given schema was found.
 /// </returns>
 public static ISequence FindSequence([NotNull] this IModel model, [NotNull] string name, [CanBeNull] string schema = null)
 => Sequence.FindSequence(
     Check.NotNull(model, nameof(model)), Check.NotEmpty(name, nameof(name)), Check.NullButNotEmpty(schema, nameof(schema)));
Пример #5
0
        /// <summary>
        ///     Returns an object that can be used to configure a given entity type in the model.
        ///     If an entity type with the provided name is not already part of the model,
        ///     a new entity type that does not have a corresponding CLR type will be added to the model.
        /// </summary>
        /// <param name="name"> The name of the entity type to be configured. </param>
        /// <returns> An object that can be used to configure the entity type. </returns>
        public virtual EntityTypeBuilder Entity([NotNull] string name)
        {
            Check.NotEmpty(name, nameof(name));

            return(new EntityTypeBuilder(Builder.Entity(name, ConfigurationSource.Explicit, throwOnQuery: true)));
        }
Пример #6
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="CommentAttribute" /> class.
        /// </summary>
        /// <param name="comment"> The comment. </param>
        public CommentAttribute(string comment)
        {
            Check.NotEmpty(comment, nameof(comment));

            Comment = comment;
        }
Пример #7
0
 /// <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)));