Пример #1
0
        /// <summary>
        ///     Configures the property name that the entity collection is mapped to when stored as an embedded document.
        /// </summary>
        /// <remarks> If an empty string is supplied then the property will not be persisted. </remarks>
        /// <param name="entityTypeBuilder"> The builder for the entity type being configured. </param>
        /// <param name="name"> The name of the container. </param>
        /// <returns> The same builder instance so that multiple calls can be chained. </returns>
        public static CollectionOwnershipBuilder ToProperty(
            [NotNull] this CollectionOwnershipBuilder entityTypeBuilder,
            [CanBeNull] string name)
        {
            entityTypeBuilder.GetInfrastructure <InternalEntityTypeBuilder>()
            .Cosmos(ConfigurationSource.Explicit)
            .ToProperty(name);

            return(entityTypeBuilder);
        }
Пример #2
0
        /// <summary>
        ///     Configures the property name that the entity collection is mapped to when stored as an embedded document.
        /// </summary>
        /// <remarks> If an empty string is supplied then the property will not be persisted. </remarks>
        /// <param name="entityTypeBuilder"> The builder for the entity type being configured. </param>
        /// <param name="name"> The name of the container. </param>
        /// <returns> The same builder instance so that multiple calls can be chained. </returns>
        public static CollectionOwnershipBuilder <TEntity, TDependentEntity> ToProperty <TEntity, TDependentEntity>(
            [NotNull] this CollectionOwnershipBuilder <TEntity, TDependentEntity> entityTypeBuilder,
            [CanBeNull] string name)
            where TEntity : class
            where TDependentEntity : class
        {
            entityTypeBuilder.GetInfrastructure <InternalEntityTypeBuilder>()
            .Cosmos(ConfigurationSource.Explicit)
            .ToProperty(name);

            return(entityTypeBuilder);
        }
        /// <summary>
        ///     Configures the container that the entity maps to when targeting Azure Cosmos.
        /// </summary>
        /// <param name="referenceOwnershipBuilder"> The builder for the entity type being configured. </param>
        /// <param name="name"> The name of the container. </param>
        /// <returns> The same builder instance so that multiple calls can be chained. </returns>
        public static CollectionOwnershipBuilder ToContainer(
            [NotNull] this CollectionOwnershipBuilder referenceOwnershipBuilder,
            [CanBeNull] string name)
        {
            Check.NotNull(referenceOwnershipBuilder, nameof(referenceOwnershipBuilder));
            Check.NullButNotEmpty(name, nameof(name));

            referenceOwnershipBuilder.GetInfrastructure <InternalEntityTypeBuilder>()
            .Cosmos(ConfigurationSource.Explicit)
            .ToContainer(name);

            return(referenceOwnershipBuilder);
        }
        /// <summary>
        ///     Configures the foreign key constraint name for this relationship when targeting a relational database.
        /// </summary>
        /// <param name="referenceReferenceBuilder"> 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 CollectionOwnershipBuilder HasConstraintName(
            [NotNull] this CollectionOwnershipBuilder referenceReferenceBuilder,
            [CanBeNull] string name)
        {
            Check.NotNull(referenceReferenceBuilder, nameof(referenceReferenceBuilder));
            Check.NullButNotEmpty(name, nameof(name));

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

            return(referenceReferenceBuilder);
        }
        /// <summary>
        ///     Configures the view or table that the entity maps to when targeting a relational database.
        /// </summary>
        /// <param name="collectionOwnershipBuilder"> The builder for the entity type being configured. </param>
        /// <param name="name"> The name of the view or table. </param>
        /// <returns> The same builder instance so that multiple calls can be chained. </returns>
        public static CollectionOwnershipBuilder ToTable(
            [NotNull] this CollectionOwnershipBuilder collectionOwnershipBuilder,
            [CanBeNull] string name)
        {
            Check.NotNull(collectionOwnershipBuilder, nameof(collectionOwnershipBuilder));
            Check.NullButNotEmpty(name, nameof(name));

            collectionOwnershipBuilder.GetInfrastructure <InternalEntityTypeBuilder>()
            .Relational(ConfigurationSource.Explicit)
            .ToTable(name);

            return(collectionOwnershipBuilder);
        }