Exemple #1
0
 /// <summary>
 ///     Configures the foreign key constraint name for this relationship when targeting a relational database.
 /// </summary>
 /// <param name="ownershipBuilder"> The builder being used to configure the relationship. </param>
 /// <param name="name"> The name of the foreign key constraint. </param>
 /// <returns> The same builder instance so that multiple calls can be chained. </returns>
 /// <typeparam name="TEntity"> The entity type on one end of the relationship. </typeparam>
 /// <typeparam name="TDependentEntity"> The entity type on the other end of the relationship. </typeparam>
 public static OwnershipBuilder <TEntity, TDependentEntity> HasConstraintName <TEntity, TDependentEntity>(
     [NotNull] this OwnershipBuilder <TEntity, TDependentEntity> ownershipBuilder,
     [CanBeNull] string name)
     where TEntity : class
     where TDependentEntity : class
 => (OwnershipBuilder <TEntity, TDependentEntity>)HasConstraintName(
     (OwnershipBuilder)ownershipBuilder, name);
Exemple #2
0
 /// <summary>
 ///     Configures the foreign key constraint name for this relationship when targeting a relational database.
 /// </summary>
 /// <remarks>
 ///     See <see href="https://aka.ms/efcore-docs-modeling">Modeling entity types and relationships</see> for more information and examples.
 /// </remarks>
 /// <param name="ownershipBuilder">The builder being used to configure the relationship.</param>
 /// <param name="name">The name of the foreign key constraint.</param>
 /// <returns>The same builder instance so that multiple calls can be chained.</returns>
 /// <typeparam name="TEntity">The entity type on one end of the relationship.</typeparam>
 /// <typeparam name="TDependentEntity">The entity type on the other end of the relationship.</typeparam>
 public static OwnershipBuilder <TEntity, TDependentEntity> HasConstraintName <TEntity, TDependentEntity>(
     this OwnershipBuilder <TEntity, TDependentEntity> ownershipBuilder,
     string?name)
     where TEntity : class
     where TDependentEntity : class
 => (OwnershipBuilder <TEntity, TDependentEntity>)HasConstraintName(
     (OwnershipBuilder)ownershipBuilder, name);
 protected OwnershipBuilder(
     InternalForeignKeyBuilder builder,
     OwnershipBuilder oldBuilder,
     bool foreignKeySet   = false,
     bool principalKeySet = false,
     bool requiredSet     = false)
     : base(builder, oldBuilder, foreignKeySet, principalKeySet, requiredSet)
 {
 }
Exemple #4
0
        /// <summary>
        ///     Configures the foreign key constraint name for this relationship when targeting a relational database.
        /// </summary>
        /// <param name="ownershipBuilder"> The builder being used to configure the relationship. </param>
        /// <param name="name"> The name of the foreign key constraint. </param>
        /// <returns> The same builder instance so that multiple calls can be chained. </returns>
        public static OwnershipBuilder HasConstraintName(
            [NotNull] this OwnershipBuilder ownershipBuilder,
            [CanBeNull] string name)
        {
            Check.NullButNotEmpty(name, nameof(name));

            ownershipBuilder.Metadata.SetConstraintName(name);

            return(ownershipBuilder);
        }
        /// <summary>
        ///     Configures the foreign key constraint name for this relationship when targeting a relational database.
        /// </summary>
        /// <param name="ownershipBuilder"> The builder being used to configure the relationship. </param>
        /// <param name="name"> The name of the foreign key constraint. </param>
        /// <returns> The same builder instance so that multiple calls can be chained. </returns>
        public static OwnershipBuilder HasConstraintName(
            [NotNull] this OwnershipBuilder ownershipBuilder,
            [CanBeNull] string name)
        {
            Check.NullButNotEmpty(name, nameof(name));

            ownershipBuilder.GetInfrastructure <InternalRelationshipBuilder>()
            .Relational(ConfigurationSource.Explicit)
            .HasConstraintName(name);

            return(ownershipBuilder);
        }
Exemple #6
0
 protected virtual NonGenericTestOwnershipBuilder <TNewEntity, TNewRelatedEntity> Wrap <TNewEntity, TNewRelatedEntity>(
     OwnershipBuilder ownershipBuilder)
     where TNewEntity : class
     where TNewRelatedEntity : class
 => new NonGenericTestOwnershipBuilder <TNewEntity, TNewRelatedEntity>(ownershipBuilder);
Exemple #7
0
 public NonGenericTestOwnershipBuilder(OwnershipBuilder ownershipBuilder)
 {
     OwnershipBuilder = ownershipBuilder;
 }
Exemple #8
0
 protected virtual GenericTestOwnershipBuilder <TNewEntity, TNewDependentEntity> Wrap <TNewEntity, TNewDependentEntity>(
     OwnershipBuilder <TNewEntity, TNewDependentEntity> ownershipBuilder)
     where TNewEntity : class
     where TNewDependentEntity : class
 => new GenericTestOwnershipBuilder <TNewEntity, TNewDependentEntity>(ownershipBuilder);
Exemple #9
0
 public GenericTestOwnershipBuilder(OwnershipBuilder <TEntity, TDependentEntity> ownershipBuilder)
 {
     OwnershipBuilder = ownershipBuilder;
 }