IReadOnlyProperty Interface

Definition

Represents a scalar property of a structural type.

public interface IReadOnlyProperty : Microsoft.EntityFrameworkCore.Metadata.IReadOnlyPropertyBase
type IReadOnlyProperty = interface
    interface IReadOnlyPropertyBase
    interface IReadOnlyAnnotatable
Public Interface IReadOnlyProperty
Implements IReadOnlyPropertyBase
Derived
Implements

Remarks

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

Properties

ClrType

Gets the type of value that this property-like object holds.

(Inherited from IReadOnlyPropertyBase)
DeclaringEntityType
Obsolete.

Gets the entity type that this property belongs to.

DeclaringType

Gets the type that this property-like object belongs to.

(Inherited from IReadOnlyPropertyBase)
FieldInfo

Gets the FieldInfo for the underlying CLR field for this property-like object. This may be null for shadow properties or if the backing field is not known.

(Inherited from IReadOnlyPropertyBase)
IsConcurrencyToken

Gets a value indicating whether this property is 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.

IsNullable

Gets a value indicating whether this property can contain null.

IsPrimitiveCollection

A property is a primitive collection if it has an element type that matches the element type of the CLR type.

Item[String]

Gets the value of the annotation with the given name, returning null if it does not exist.

(Inherited from IReadOnlyAnnotatable)
Name

Gets the name of this property-like object.

(Inherited from IReadOnlyPropertyBase)
PropertyInfo

Gets the PropertyInfo for the underlying CLR property for this property-like object. This may be null for shadow properties or if mapped directly to a field.

(Inherited from IReadOnlyPropertyBase)
Sentinel

Gets the sentinel value that indicates that this property is not set.

(Inherited from IReadOnlyPropertyBase)
ValueGenerated

Gets a value indicating when a value for this property will be generated by the database. Even when the property is set to be generated by the database, EF may still attempt to save a specific value (rather than having one generated by the database) when the entity is added and a value is assigned, or the property is marked as modified for an existing entity. See GetBeforeSaveBehavior() and GetAfterSaveBehavior() for more information and examples.

Methods

AnnotationsToDebugString(Int32)

Gets the debug string for all annotations declared on the object.

(Inherited from IReadOnlyAnnotatable)
FindAnnotation(String)

Gets the annotation with the given name, returning null if it does not exist.

(Inherited from IReadOnlyAnnotatable)
FindContainingPrimaryKey()

Gets the primary key that uses this property (including a composite primary key in which this property is included).

FindFirstPrincipal()

Finds the first principal property that the given property is constrained by if the given property is part of a foreign key.

FindTypeMapping()

Returns the type mapping for this property.

GetAfterSaveBehavior()

Gets a value indicating whether or not this property can be modified after the entity is saved to the database.

GetAnnotation(String)

Gets the annotation with the given name, throwing if it does not exist.

(Inherited from IReadOnlyAnnotatable)
GetAnnotations()

Gets all annotations on the current object.

(Inherited from IReadOnlyAnnotatable)
GetBeforeSaveBehavior()

Gets a value indicating whether or not this property can be modified before the entity is saved to the database.

GetContainingForeignKeys()

Gets all foreign keys that use this property (including composite foreign keys in which this property is included).

GetContainingIndexes()

Gets all indexes that use this property (including composite indexes in which this property is included).

GetContainingKeys()

Gets all primary or alternate keys that use this property (including composite keys in which this property is included).

GetElementType()

Gets the configuration for elements of the primitive collection represented by this property.

GetFieldName()

Gets the name of the backing field for this property, or null if the backing field is not known.

(Inherited from IReadOnlyPropertyBase)
GetJsonValueReaderWriter()

Gets the JsonValueReaderWriter for this property, or null if none is set.

GetKeyValueComparer()

Gets the ValueComparer to use with keys for this property, or null if none is set.

GetMaxLength()

Gets the maximum length of data that is allowed in this property. For example, if the property is a String then this is the maximum number of characters.

GetPrecision()

Gets the precision of data that is allowed in this property. For example, if the property is a Decimal then this is the maximum number of digits.

GetPrincipals()

Finds the list of principal properties including the given property that the given property is constrained by if the given property is part of a foreign key.

GetPrincipals<T>()

Finds the list of principal properties including the given property that the given property is constrained by if the given property is part of a foreign key.

GetPropertyAccessMode()

Gets the PropertyAccessMode being used for this property-like object.

(Inherited from IReadOnlyPropertyBase)
GetProviderClrType()

Gets the type that the property value will be converted to before being sent to the database provider.

GetProviderValueComparer()

Gets the ValueComparer to use for the provider values for this property.

GetScale()

Gets the scale of data that is allowed in this property. For example, if the property is a Decimal then this is the maximum number of decimal places.

GetTypeMapping()

Returns the CoreTypeMapping for the given property from a finalized model.

GetValueComparer()

Gets the ValueComparer for this property, or null if none is set.

GetValueConverter()

Gets the custom ValueConverter set for this property.

GetValueGeneratorFactory()

Gets the factory that has been set to generate values for this property, if any.

IsForeignKey()

Gets a value indicating whether this property is used as a foreign key (or part of a composite foreign key).

IsIndex()

Gets a value indicating whether this property is used as an index (or part of a composite index).

IsIndexerProperty()

Gets a value indicating whether this is an indexer property. An indexer property is one that is accessed through an indexer on the entity class.

(Inherited from IReadOnlyPropertyBase)
IsKey()

Gets a value indicating whether this property is used as the primary key or alternate key (or part of a composite primary or alternate key).

IsPrimaryKey()

Gets a value indicating whether this property is used as the primary key (or part of a composite primary key).

IsShadowProperty()

Gets a value indicating whether this is a shadow property. A shadow property is one that does not have a corresponding property in the entity class. The current value for the property is stored in the ChangeTracker rather than being stored in instances of the entity class.

(Inherited from IReadOnlyPropertyBase)
IsUnicode()

Gets a value indicating whether or not the property can persist Unicode characters.

IsUniqueIndex()

Gets a value indicating whether this property is used as a unique index (or part of a unique composite index).

ToDebugString(MetadataDebugStringOptions, Int32)

Creates a human-readable representation of the given metadata.

Warning: Do not rely on the format of the returned string. It is designed for debugging only and may change arbitrarily between releases.

Extension Methods

GetJsonPropertyName(IReadOnlyProperty)

Returns the property name that the property is mapped to when targeting Cosmos.

FindOverrides(IReadOnlyProperty, StoreObjectIdentifier)

Returns the property facet overrides for a particular table-like store object.

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

FindRelationalTypeMapping(IReadOnlyProperty)

Returns the RelationalTypeMapping for the given property on a finalized model.

FindRelationalTypeMapping(IReadOnlyProperty, StoreObjectIdentifier)

Returns the RelationalTypeMapping for the given property on a finalized model.

FindSharedStoreObjectRootProperty(IReadOnlyProperty, StoreObjectIdentifier)

Finds the first IProperty that is mapped to the same column in a shared table-like object.

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

GetCollation(IReadOnlyProperty)

Returns the collation to be used for the column.

GetCollation(IReadOnlyProperty, StoreObjectIdentifier)

Returns the collation to be used for the column.

GetColumnBaseName(IReadOnlyProperty)
Obsolete.

Returns the base name of the column to which the property would be mapped.

GetColumnName(IReadOnlyProperty)

Returns the name of the column to which the property would be mapped.

GetColumnName(IReadOnlyProperty, StoreObjectIdentifier)

Returns the name of the column to which the property is mapped for a particular table.

GetColumnOrder(IReadOnlyProperty)

Returns the order of the column this property is mapped to.

GetColumnOrder(IReadOnlyProperty, StoreObjectIdentifier)

Returns the order of the column this property is mapped to for a particular table.

GetColumnType(IReadOnlyProperty)

Returns the database type of the column to which the property is mapped, or null if the database type could not be found.

GetColumnType(IReadOnlyProperty, StoreObjectIdentifier)

Returns the database type of the column to which the property is mapped, or null if the database type could not be found.

GetComment(IReadOnlyProperty)

Returns the comment for the column this property is mapped to.

GetComment(IReadOnlyProperty, StoreObjectIdentifier)

Returns the comment for the column this property is mapped to.

GetComputedColumnSql(IReadOnlyProperty)

Returns the SQL expression that is used as the computed value for the column this property is mapped to.

GetComputedColumnSql(IReadOnlyProperty, StoreObjectIdentifier)

Returns the SQL expression that is used as the computed value for the column this property is mapped to.

GetDefaultColumnBaseName(IReadOnlyProperty)
Obsolete.

Returns the default base name of the column to which the property would be mapped

GetDefaultColumnName(IReadOnlyProperty)

Returns the default base name of the column to which the property would be mapped

GetDefaultColumnName(IReadOnlyProperty, StoreObjectIdentifier)

Returns the default column name to which the property would be mapped.

GetDefaultValue(IReadOnlyProperty)

Returns the object that is used as the default value for the column this property is mapped to.

GetDefaultValue(IReadOnlyProperty, StoreObjectIdentifier)

Returns the object that is used as the default value for the column this property is mapped to.

GetDefaultValueSql(IReadOnlyProperty)

Returns the SQL expression that is used as the default value for the column this property is mapped to.

GetDefaultValueSql(IReadOnlyProperty, StoreObjectIdentifier)

Returns the SQL expression that is used as the default value for the column this property is mapped to.

GetIsStored(IReadOnlyProperty)

Gets whether the value of the computed column this property is mapped to is stored in the database, or calculated when it is read.

GetIsStored(IReadOnlyProperty, StoreObjectIdentifier)

Gets whether the value of the computed column this property is mapped to is stored in the database, or calculated when it is read.

GetJsonPropertyName(IReadOnlyProperty)

Gets the value of JSON property name used for the given property of an entity mapped to a JSON column.

GetMappedStoreObjects(IReadOnlyProperty, StoreObjectType)

Returns the table-like store objects to which this property is mapped.

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

GetMaxLength(IReadOnlyProperty, StoreObjectIdentifier)

Gets the maximum length of data that is allowed in this property. For example, if the property is a String then this is the maximum number of characters.

GetOverrides(IReadOnlyProperty)

Returns all the property facet overrides.

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

GetPrecision(IReadOnlyProperty, StoreObjectIdentifier)

Gets the precision of data that is allowed in this property. For example, if the property is a Decimal then this is the maximum number of digits.

GetRelationalTypeMapping(IReadOnlyProperty)

Returns the RelationalTypeMapping for the given property on a finalized model.

GetScale(IReadOnlyProperty, StoreObjectIdentifier)

Gets the scale of data that is allowed in this property. For example, if the property is a Decimal then this is the maximum number of decimal places.

IsColumnNullable(IReadOnlyProperty)

Checks whether the column mapped to the given IProperty will be nullable when created in the database.

IsColumnNullable(IReadOnlyProperty, StoreObjectIdentifier)

Checks whether the column mapped to the given property will be nullable when created in the database.

IsFixedLength(IReadOnlyProperty)

Returns a flag indicating whether the property is capable of storing only fixed-length data, such as strings.

IsFixedLength(IReadOnlyProperty, StoreObjectIdentifier)

Returns a flag indicating whether the property is capable of storing only fixed-length data, such as strings.

IsUnicode(IReadOnlyProperty, StoreObjectIdentifier)

Gets a value indicating whether or not the property can persist Unicode characters.

TryGetDefaultValue(IReadOnlyProperty, StoreObjectIdentifier, Object)

Returns the object that is used as the default value for the column this property is mapped to.

TryGetDefaultValue(IReadOnlyProperty, Object)

Returns the object that is used as the default value for the column this property is mapped to.

GetSrid(IReadOnlyProperty)

Returns the SRID to use when creating a column for this property.

GetSrid(IReadOnlyProperty, StoreObjectIdentifier)

Returns the SRID to use when creating a column for this property.

FindHiLoSequence(IReadOnlyProperty)

Finds the ISequence in the model to use for the hi-lo pattern.

FindHiLoSequence(IReadOnlyProperty, StoreObjectIdentifier)

Finds the ISequence in the model to use for the hi-lo pattern.

FindSequence(IReadOnlyProperty)

Finds the ISequence in the model to use for the key value generation pattern.

FindSequence(IReadOnlyProperty, StoreObjectIdentifier)

Finds the ISequence in the model to use for the key value generation pattern.

GetHiLoSequenceName(IReadOnlyProperty)

Returns the name to use for the hi-lo sequence.

GetHiLoSequenceName(IReadOnlyProperty, StoreObjectIdentifier)

Returns the name to use for the hi-lo sequence.

GetHiLoSequenceSchema(IReadOnlyProperty)

Returns the schema to use for the hi-lo sequence.

GetHiLoSequenceSchema(IReadOnlyProperty, StoreObjectIdentifier)

Returns the schema to use for the hi-lo sequence.

GetIdentityIncrement(IReadOnlyProperty)

Returns the identity increment.

GetIdentityIncrement(IReadOnlyProperty, StoreObjectIdentifier)

Returns the identity increment.

GetIdentitySeed(IReadOnlyProperty)

Returns the identity seed.

GetIdentitySeed(IReadOnlyProperty, StoreObjectIdentifier)

Returns the identity seed.

GetSequenceName(IReadOnlyProperty)

Returns the name to use for the key value generation sequence.

GetSequenceName(IReadOnlyProperty, StoreObjectIdentifier)

Returns the name to use for the key value generation sequence.

GetSequenceSchema(IReadOnlyProperty)

Returns the schema to use for the key value generation sequence.

GetSequenceSchema(IReadOnlyProperty, StoreObjectIdentifier)

Returns the schema to use for the key value generation sequence.

GetValueGenerationStrategy(IReadOnlyProperty)

Returns the SqlServerValueGenerationStrategy to use for the property.

GetValueGenerationStrategy(IReadOnlyProperty, StoreObjectIdentifier)

Returns the SqlServerValueGenerationStrategy to use for the property.

IsSparse(IReadOnlyProperty)

Returns a value indicating whether the property's column is sparse.

IsSparse(IReadOnlyProperty, StoreObjectIdentifier)

Returns a value indicating whether the property's column is sparse.

Applies to