Freigeben über


PrimitiveCollectionBuilder<TProperty> Class

Definition

Provides a simple API for configuring a IMutableProperty.

public class PrimitiveCollectionBuilder<TProperty> : Microsoft.EntityFrameworkCore.Metadata.Builders.PrimitiveCollectionBuilder
type PrimitiveCollectionBuilder<'Property> = class
    inherit PrimitiveCollectionBuilder
Public Class PrimitiveCollectionBuilder(Of TProperty)
Inherits PrimitiveCollectionBuilder

Type Parameters

TProperty
Inheritance
PrimitiveCollectionBuilder<TProperty>

Remarks

Instances of this class are returned from methods when using the ModelBuilder API and it is not designed to be directly constructed in your application code.

See Modeling entity types and relationships for more information and examples.

Constructors

PrimitiveCollectionBuilder<TProperty>(IMutableProperty)

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

Properties

Metadata

The property being configured.

(Inherited from PrimitiveCollectionBuilder)

Methods

ElementType()

Configures the elements of this collection.

(Inherited from PrimitiveCollectionBuilder)
ElementType(Action<ElementTypeBuilder>)

Configures the elements of this collection.

HasAnnotation(String, Object)

Adds or updates an annotation on the property. If an annotation with the key specified in annotation already exists its value will be updated.

HasField(String)

Sets the backing field to use for this property.

HasMaxLength(Int32)

Configures the maximum length of data that can be stored in this property. Maximum length can only be set on array properties (including String properties).

HasSentinel(Object)

Configures the value that will be used to determine if the property has been set or not. If the property is set to the sentinel value, then it is considered not set. By default, the sentinel value is the CLR default value for the type of the property.

HasSentinel(TProperty)

Configures the value that will be used to determine if the property has been set or not. If the property is set to the sentinel value, then it is considered not set. By default, the sentinel value is the CLR default value for the type of the property.

HasValueGenerator(Type)

Configures the ValueGenerator that will generate values for this property.

HasValueGenerator<TGenerator>()

Configures the ValueGenerator that will generate values for this property.

HasValueGeneratorFactory(Type)

Configures the ValueGeneratorFactory for creating a ValueGenerator to use to generate values for this property.

HasValueGeneratorFactory<TFactory>()

Configures the ValueGeneratorFactory for creating a ValueGenerator to use to generate values for this property.

IsConcurrencyToken(Boolean)

Configures whether this property should be used as a concurrency token. When a property is configured as a concurrency token the value in the database will be checked when an instance of this entity type is updated or deleted during SaveChanges() to ensure it has not changed since the instance was retrieved from the database. If it has changed, an exception will be thrown and the changes will not be applied to the database.

IsRequired(Boolean)

Configures whether this property must have a value assigned or whether null is a valid value. A property can only be configured as non-required if it is based on a CLR type that can be assigned null.

IsUnicode(Boolean)

Configures the property as capable of persisting unicode characters. Can only be set on String properties.

UsePropertyAccessMode(PropertyAccessMode)

Sets the PropertyAccessMode to use for this property.

ValueGeneratedNever()

Configures a property to never have a value generated when an instance of this entity type is saved.

ValueGeneratedOnAdd()

Configures a property to have a value generated only when saving a new entity, unless a non-null, non-temporary value has been set, in which case the set value will be saved instead. The value may be generated by a client-side value generator or may be generated by the database as part of saving the entity.

ValueGeneratedOnAddOrUpdate()

Configures a property to have a value generated when saving a new or existing entity.

ValueGeneratedOnUpdate()

Configures a property to have a value generated when saving an existing entity.

ValueGeneratedOnUpdateSometimes()

Configures a property to have a value generated under certain conditions when saving an existing entity.

Explicit Interface Implementations

IInfrastructure<IConventionPropertyBuilder>.Instance

The internal builder being used to configure the property.

(Inherited from PrimitiveCollectionBuilder)

Extension Methods

ToJsonProperty(PrimitiveCollectionBuilder, String)

Configures the property name that the property is mapped to when targeting Azure Cosmos.

ToJsonProperty<TProperty>(PrimitiveCollectionBuilder<TProperty>, String)

Configures the property name that the property is mapped to when targeting Azure Cosmos.

GetInfrastructure<T>(IInfrastructure<T>)

Gets the value from a property that is being hidden using IInfrastructure<T>.

This method is typically used by database providers (and other extensions). It is generally not used in application code.

HasColumnName(PrimitiveCollectionBuilder, String)

Configures the column that the property maps to when targeting a relational database.

HasColumnName<TProperty>(PrimitiveCollectionBuilder<TProperty>, String)

Configures the column that the property maps to when targeting a relational database.

HasColumnOrder(PrimitiveCollectionBuilder, Nullable<Int32>)

Configures the order of the column the property is mapped to.

HasColumnOrder<TProperty>(PrimitiveCollectionBuilder<TProperty>, Nullable<Int32>)

Configures the order of the column the property is mapped to.

HasColumnType(PrimitiveCollectionBuilder, String)

Configures the data type of the column that the property maps to when targeting a relational database. This should be the complete type name, including precision, scale, length, etc.

HasColumnType<TProperty>(PrimitiveCollectionBuilder<TProperty>, String)

Configures the data type of the column that the property maps to when targeting a relational database. This should be the complete type name, including precision, scale, length, etc.

HasComment(PrimitiveCollectionBuilder, String)

Configures a comment to be applied to the column

HasComment<TProperty>(PrimitiveCollectionBuilder<TProperty>, String)

Configures a comment to be applied to the column

HasComputedColumnSql(PrimitiveCollectionBuilder, String, Nullable<Boolean>)

Configures the property to map to a computed column when targeting a relational database.

HasComputedColumnSql(PrimitiveCollectionBuilder, String)

Configures the property to map to a computed column when targeting a relational database.

HasComputedColumnSql(PrimitiveCollectionBuilder)

Configures the property to map to a computed column when targeting a relational database.

HasComputedColumnSql<TProperty>(PrimitiveCollectionBuilder<TProperty>, String, Nullable<Boolean>)

Configures the property to map to a computed column when targeting a relational database.

HasComputedColumnSql<TProperty>(PrimitiveCollectionBuilder<TProperty>, String)

Configures the property to map to a computed column when targeting a relational database.

HasComputedColumnSql<TProperty>(PrimitiveCollectionBuilder<TProperty>)

Configures the property to map to a computed column when targeting a relational database.

HasDefaultValue(PrimitiveCollectionBuilder, Object)

Configures the default value for the column that the property maps to when targeting a relational database.

HasDefaultValue(PrimitiveCollectionBuilder)

Configures the default value for the column that the property maps to when targeting a relational database.

HasDefaultValue<TProperty>(PrimitiveCollectionBuilder<TProperty>, Object)

Configures the default value for the column that the property maps to when targeting a relational database.

HasDefaultValue<TProperty>(PrimitiveCollectionBuilder<TProperty>)

Configures the default value for the column that the property maps to when targeting a relational database.

HasDefaultValueSql(PrimitiveCollectionBuilder, String)

Configures the default value expression for the column that the property maps to when targeting a relational database.

HasDefaultValueSql(PrimitiveCollectionBuilder)

Configures the default value expression for the column that the property maps to when targeting a relational database.

HasDefaultValueSql<TProperty>(PrimitiveCollectionBuilder<TProperty>, String)

Configures the default value expression for the column that the property maps to when targeting a relational database.

HasDefaultValueSql<TProperty>(PrimitiveCollectionBuilder<TProperty>)

Configures the default value expression for the column that the property maps to when targeting a relational database.

HasJsonPropertyName(PrimitiveCollectionBuilder, String)

Configures the property of an entity mapped to a JSON column, mapping the entity property to a specific JSON property, rather than using the entity property name.

HasJsonPropertyName<TProperty>(PrimitiveCollectionBuilder<TProperty>, String)

Configures the property of an entity mapped to a JSON column, mapping the entity property to a specific JSON property, rather than using the entity property name.

IsFixedLength(PrimitiveCollectionBuilder, Boolean)

Configures the property as capable of storing only fixed-length data, such as strings.

IsFixedLength<TProperty>(PrimitiveCollectionBuilder<TProperty>, Boolean)

Configures the property as capable of storing only fixed-length data, such as strings.

UseCollation(PrimitiveCollectionBuilder, String)

Configures the property to use the given collation. The database column will be created with the given collation, and it will be used implicitly in all collation-sensitive operations.

UseCollation<TProperty>(PrimitiveCollectionBuilder<TProperty>, String)

Configures the property to use the given collation. The database column will be created with the given collation, and it will be used implicitly in all collation-sensitive operations.

IsSparse(PrimitiveCollectionBuilder, Boolean)

Configures whether the property's column is created as sparse when targeting SQL Server.

IsSparse<TProperty>(PrimitiveCollectionBuilder<TProperty>, Boolean)

Configures whether the property's column is created as sparse when targeting SQL Server.

Applies to