/// <summary> /// Configures the view or table that the entity maps to when targeting a relational database. /// </summary> /// <typeparam name="TEntity"> The entity type being configured. </typeparam> /// <typeparam name="TDependentEntity"> The entity type that this relationship targets. </typeparam> /// <param name="collectionOwnershipBuilder"> The builder for the entity type being configured. </param> /// <param name="name"> The name of the view or table. </param> /// <param name="schema"> The schema of the view or table. </param> /// <returns> The same builder instance so that multiple calls can be chained. </returns> public static CollectionOwnershipBuilder <TEntity, TDependentEntity> ToTable <TEntity, TDependentEntity>( [NotNull] this CollectionOwnershipBuilder <TEntity, TDependentEntity> collectionOwnershipBuilder, [CanBeNull] string name, [CanBeNull] string schema) where TEntity : class where TDependentEntity : class => (CollectionOwnershipBuilder <TEntity, TDependentEntity>)ToTable((CollectionOwnershipBuilder)collectionOwnershipBuilder, name, schema);
/// <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> /// <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 CollectionOwnershipBuilder <TEntity, TDependentEntity> HasConstraintName <TEntity, TDependentEntity>( [NotNull] this CollectionOwnershipBuilder <TEntity, TDependentEntity> referenceReferenceBuilder, [CanBeNull] string name) where TEntity : class where TDependentEntity : class => (CollectionOwnershipBuilder <TEntity, TDependentEntity>)HasConstraintName( (CollectionOwnershipBuilder)referenceReferenceBuilder, name);
/// <summary> /// Configures the table that the entity maps to when targeting MySql as memory-optimized. /// </summary> /// <param name="collectionOwnershipBuilder"> The builder for the entity type being configured. </param> /// <param name="memoryOptimized"> A value indicating whether the table is memory-optimized. </param> /// <returns> The same builder instance so that multiple calls can be chained. </returns> public static CollectionOwnershipBuilder ForMySqlIsMemoryOptimized( [NotNull] this CollectionOwnershipBuilder collectionOwnershipBuilder, bool memoryOptimized = true) { Check.NotNull(collectionOwnershipBuilder, nameof(collectionOwnershipBuilder)); collectionOwnershipBuilder.OwnedEntityType.MySql().IsMemoryOptimized = memoryOptimized; return(collectionOwnershipBuilder); }
public void Configure <T>(CollectionOwnershipBuilder <T, PhoneNumber> collectionOwnership) where T : class { Action <CollectionOwnershipBuilder <T, PhoneNumber> > setupAction = new Action <CollectionOwnershipBuilder <T, PhoneNumber> >(cfg => { cfg.Property(phoneNumber => phoneNumber.Number).IsRequired().HasMaxLength(11); }); setupAction(collectionOwnership); }
/// <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); }
/// <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); }
protected virtual GenericTestCollectionOwnershipBuilder <TNewEntity, TNewDependentEntity> Wrap <TNewEntity, TNewDependentEntity>( CollectionOwnershipBuilder <TNewEntity, TNewDependentEntity> collectionOwnershipBuilder) where TNewEntity : class where TNewDependentEntity : class => new GenericTestCollectionOwnershipBuilder <TNewEntity, TNewDependentEntity>(collectionOwnershipBuilder);
public GenericTestCollectionOwnershipBuilder(CollectionOwnershipBuilder <TEntity, TDependentEntity> collectionOwnershipBuilder) { CollectionOwnershipBuilder = collectionOwnershipBuilder; }
protected virtual NonGenericTestCollectionOwnershipBuilder <TNewEntity, TNewRelatedEntity> Wrap <TNewEntity, TNewRelatedEntity>( CollectionOwnershipBuilder collectionOwnershipBuilder) where TNewEntity : class where TNewRelatedEntity : class => new NonGenericTestCollectionOwnershipBuilder <TNewEntity, TNewRelatedEntity>(collectionOwnershipBuilder);
public NonGenericTestCollectionOwnershipBuilder(CollectionOwnershipBuilder collectionOwnershipBuilder) { CollectionOwnershipBuilder = collectionOwnershipBuilder; }
/// <summary> /// Configures the container that the entity maps to when targeting Azure Cosmos. /// </summary> /// <typeparam name="TEntity"> The entity type being configured. </typeparam> /// <typeparam name="TDependentEntity"> The entity type that this relationship targets. </typeparam> /// <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 <TEntity, TDependentEntity> ToContainer <TEntity, TDependentEntity>( [NotNull] this CollectionOwnershipBuilder <TEntity, TDependentEntity> referenceOwnershipBuilder, [CanBeNull] string name) where TEntity : class where TDependentEntity : class => (CollectionOwnershipBuilder <TEntity, TDependentEntity>)ToContainer((CollectionOwnershipBuilder)referenceOwnershipBuilder, name);
/// <summary> /// Configures the table that the entity maps to when targeting MySql as memory-optimized. /// </summary> /// <typeparam name="TEntity"> The entity type being configured. </typeparam> /// <typeparam name="TRelatedEntity"> The entity type that this relationship targets. </typeparam> /// <param name="collectionOwnershipBuilder"> The builder for the entity type being configured. </param> /// <param name="memoryOptimized"> A value indicating whether the table is memory-optimized. </param> /// <returns> The same builder instance so that multiple calls can be chained. </returns> public static CollectionOwnershipBuilder <TEntity, TRelatedEntity> ForMySqlIsMemoryOptimized <TEntity, TRelatedEntity>( [NotNull] this CollectionOwnershipBuilder <TEntity, TRelatedEntity> collectionOwnershipBuilder, bool memoryOptimized = true) where TEntity : class where TRelatedEntity : class => (CollectionOwnershipBuilder <TEntity, TRelatedEntity>)ForMySqlIsMemoryOptimized((CollectionOwnershipBuilder)collectionOwnershipBuilder, memoryOptimized);