Table of Contents

Interface IMutablePropertyBase

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

Base type for navigation and scalar properties.

public interface IMutablePropertyBase : IReadOnlyPropertyBase, IMutableAnnotatable, IReadOnlyAnnotatable
Inherited Members
Extension Methods

Remarks

This interface is used during model creation and allows the metadata to be modified. Once the model is built, IReadOnlyPropertyBase represents a read-only view of the same metadata.

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

Properties

DeclaringType

Gets the type that this property belongs to.

IMutableTypeBase DeclaringType { get; }

Property Value

IMutableTypeBase

FieldInfo

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

FieldInfo? FieldInfo { get; set; }

Property Value

FieldInfo

Methods

SetField(string?)

Sets the underlying CLR field that this property should use.

void SetField(string? fieldName)

Parameters

fieldName string

The name of the field to use.

Remarks

Backing fields are normally found by convention. This method is useful for setting backing fields explicitly in cases where the correct field is not found by convention.

By default, the backing field, if one is found or has been specified, is used when new objects are constructed, typically when entities are queried from the database. Properties are used for all other accesses. This can be changed by calling SetPropertyAccessMode(PropertyAccessMode?).

See Backing fields for more information and examples.

SetPropertyAccessMode(PropertyAccessMode?)

Sets the PropertyAccessMode to use for this property.

void SetPropertyAccessMode(PropertyAccessMode? propertyAccessMode)

Parameters

propertyAccessMode PropertyAccessMode?

The PropertyAccessMode, or null to clear the mode set.