Table of Contents

Class RuntimeProperty

Namespace
Microsoft.EntityFrameworkCore.Metadata
Assembly
Microsoft.EntityFrameworkCore.dll

Represents a scalar property of an structural type.

public class RuntimeProperty : RuntimePropertyBase, IRuntimePropertyBase, IProperty, IReadOnlyProperty, IPropertyBase, IReadOnlyPropertyBase, IAnnotatable, IReadOnlyAnnotatable
Inheritance
RuntimeProperty
Implements
Inherited Members
Extension Methods

Remarks

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

Constructors

RuntimeProperty(string, Type, PropertyInfo?, FieldInfo?, RuntimeTypeBase, PropertyAccessMode, bool, bool, ValueGenerated, PropertySaveBehavior, PropertySaveBehavior, int?, bool?, int?, int?, Type?, Func<IProperty, ITypeBase, ValueGenerator>?, ValueConverter?, ValueComparer?, ValueComparer?, ValueComparer?, JsonValueReaderWriter?, CoreTypeMapping?, object?)

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.

[EntityFrameworkInternal]
public RuntimeProperty(string name, Type clrType, PropertyInfo? propertyInfo, FieldInfo? fieldInfo, RuntimeTypeBase declaringType, PropertyAccessMode propertyAccessMode, bool nullable, bool concurrencyToken, ValueGenerated valueGenerated, PropertySaveBehavior beforeSaveBehavior, PropertySaveBehavior afterSaveBehavior, int? maxLength, bool? unicode, int? precision, int? scale, Type? providerClrType, Func<IProperty, ITypeBase, ValueGenerator>? valueGeneratorFactory, ValueConverter? valueConverter, ValueComparer? valueComparer, ValueComparer? keyValueComparer, ValueComparer? providerValueComparer, JsonValueReaderWriter? jsonValueReaderWriter, CoreTypeMapping? typeMapping, object? sentinel)

Parameters

name string
clrType Type
propertyInfo PropertyInfo
fieldInfo FieldInfo
declaringType RuntimeTypeBase
propertyAccessMode PropertyAccessMode
nullable bool
concurrencyToken bool
valueGenerated ValueGenerated
beforeSaveBehavior PropertySaveBehavior
afterSaveBehavior PropertySaveBehavior
maxLength int?
unicode bool?
precision int?
scale int?
providerClrType Type
valueGeneratorFactory Func<IProperty, ITypeBase, ValueGenerator>
valueConverter ValueConverter
valueComparer ValueComparer
keyValueComparer ValueComparer
providerValueComparer ValueComparer
jsonValueReaderWriter JsonValueReaderWriter
typeMapping CoreTypeMapping
sentinel object

Properties

ClrType

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

protected override Type ClrType { get; }

Property Value

Type

DebugView

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.

public virtual DebugView DebugView { get; }

Property Value

DebugView

DeclaringType

public override RuntimeTypeBase DeclaringType { get; }

Property Value

RuntimeTypeBase

ForeignKeys

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.

[EntityFrameworkInternal]
public virtual List<RuntimeForeignKey>? ForeignKeys { get; set; }

Property Value

List<RuntimeForeignKey>

Indexes

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.

[EntityFrameworkInternal]
public virtual List<RuntimeIndex>? Indexes { get; set; }

Property Value

List<RuntimeIndex>

IsPrimitiveCollection

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.

public virtual bool IsPrimitiveCollection { get; }

Property Value

bool

Keys

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.

[EntityFrameworkInternal]
public virtual List<RuntimeKey>? Keys { get; set; }

Property Value

List<RuntimeKey>

PrimaryKey

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.

[EntityFrameworkInternal]
public virtual RuntimeKey? PrimaryKey { get; set; }

Property Value

RuntimeKey

Sentinel

public override object? Sentinel { get; }

Property Value

object

TypeMapping

Gets or sets the type mapping for this property.

public virtual CoreTypeMapping TypeMapping { get; set; }

Property Value

CoreTypeMapping

The type mapping.

Methods

GetElementType()

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

public virtual IElementType? GetElementType()

Returns

IElementType

The configuration for the elements.

GetJsonValueReaderWriter()

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

public virtual JsonValueReaderWriter? GetJsonValueReaderWriter()

Returns

JsonValueReaderWriter

The reader/writer, or null if none has been set.

SetElementType(Type, bool, int?, bool?, int?, int?, Type?, ValueConverter?, ValueComparer?, JsonValueReaderWriter?, CoreTypeMapping?, bool)

Sets the element type for this property.

public virtual RuntimeElementType SetElementType(Type clrType, bool nullable = false, int? maxLength = null, bool? unicode = null, int? precision = null, int? scale = null, Type? providerPropertyType = null, ValueConverter? valueConverter = null, ValueComparer? valueComparer = null, JsonValueReaderWriter? jsonValueReaderWriter = null, CoreTypeMapping? typeMapping = null, bool primitiveCollection = false)

Parameters

clrType Type

The type of value the property will hold.

nullable bool

A value indicating whether this property can contain null.

maxLength int?

The maximum length of data that is allowed in this property.

unicode bool?

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

precision int?

The precision of data that is allowed in this property.

scale int?

The scale of data that is allowed in this property.

providerPropertyType Type

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

valueConverter ValueConverter

The custom ValueConverter set for this property.

valueComparer ValueComparer

The ValueComparer for this property.

jsonValueReaderWriter JsonValueReaderWriter

The JsonValueReaderWriter for this property.

typeMapping CoreTypeMapping

The CoreTypeMapping for this property.

primitiveCollection bool

A value indicating whether this property represents a primitive collection.

Returns

RuntimeElementType

The newly created property.

SetSentinelFromProviderValue(object?)

Sets the Sentinel value, converting from the provider type if needed.

public virtual void SetSentinelFromProviderValue(object? providerValue)

Parameters

providerValue object

The value, as a provider value if a value converter is being used.

ToString()

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.

public override string ToString()

Returns

string