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
stringclrType
TypepropertyInfo
PropertyInfofieldInfo
FieldInfodeclaringType
RuntimeTypeBasepropertyAccessMode
PropertyAccessModenullable
boolconcurrencyToken
boolvalueGenerated
ValueGeneratedbeforeSaveBehavior
PropertySaveBehaviorafterSaveBehavior
PropertySaveBehaviormaxLength
int?unicode
bool?precision
int?scale
int?providerClrType
TypevalueGeneratorFactory
Func<IProperty, ITypeBase, ValueGenerator>valueConverter
ValueConvertervalueComparer
ValueComparerkeyValueComparer
ValueComparerproviderValueComparer
ValueComparerjsonValueReaderWriter
JsonValueReaderWritertypeMapping
CoreTypeMappingsentinel
object
Properties
ClrType
Gets the type of value that this property-like object holds.
protected override Type ClrType { get; }
Property Value
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
DeclaringType
public override RuntimeTypeBase DeclaringType { get; }
Property Value
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
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
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
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
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
Sentinel
public override object? Sentinel { get; }
Property Value
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
TypeThe type of value the property will hold.
nullable
boolA 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
TypeThe type that the property value will be converted to before being sent to the database provider.
valueConverter
ValueConverterThe custom ValueConverter set for this property.
valueComparer
ValueComparerThe ValueComparer for this property.
jsonValueReaderWriter
JsonValueReaderWriterThe JsonValueReaderWriter for this property.
typeMapping
CoreTypeMappingThe CoreTypeMapping for this property.
primitiveCollection
boolA 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
objectThe 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()