/// <summary> /// Configures the property name that the entity 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 OwnedNavigationBuilder ToProperty( [NotNull] this OwnedNavigationBuilder entityTypeBuilder, [CanBeNull] string name) { entityTypeBuilder.GetInfrastructure() .Cosmos(ConfigurationSource.Explicit) .ToProperty(name); return(entityTypeBuilder); }
/// <summary> /// Configures the property name that the entity 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 OwnedNavigationBuilder <TEntity, TDependentEntity> ToProperty <TEntity, TDependentEntity>( [NotNull] this OwnedNavigationBuilder <TEntity, TDependentEntity> entityTypeBuilder, [CanBeNull] string name) where TEntity : class where TDependentEntity : class { entityTypeBuilder.GetInfrastructure() .Cosmos(ConfigurationSource.Explicit) .ToProperty(name); return(entityTypeBuilder); }
/// <summary> /// Configures the view or table that the entity maps to when targeting a relational database. /// </summary> /// <param name="referenceOwnershipBuilder"> 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 OwnedNavigationBuilder ToTable( [NotNull] this OwnedNavigationBuilder referenceOwnershipBuilder, [CanBeNull] string name) { Check.NotNull(referenceOwnershipBuilder, nameof(referenceOwnershipBuilder)); Check.NullButNotEmpty(name, nameof(name)); referenceOwnershipBuilder.GetInfrastructure() .Relational(ConfigurationSource.Explicit) .ToTable(name); return(referenceOwnershipBuilder); }
private IMutableProperty ConfigurePeriodProperty(string propertyName) { // TODO: Configure the property explicitly, but remove it if it's no longer used, issue #15898 var conventionPropertyBuilder = _referenceOwnershipBuilder.GetInfrastructure().Property( typeof(DateTime), propertyName, setTypeConfigurationSource: false); // if convention builder is null, it means the property with this name exists, but it has incorrect type // we will throw in the model validation if (conventionPropertyBuilder != null) { conventionPropertyBuilder.ValueGenerated(ValueGenerated.OnAddOrUpdate); } return(_referenceOwnershipBuilder.OwnedEntityType.FindProperty(propertyName) !); }