Прочетете на английски

Споделяне чрез


IMutablePropertyBase.SetField(String) Method

Definition

Sets the underlying CLR field that this property should use.

C#
public virtual void SetField (string fieldName);
C#
public 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(Nullable<PropertyAccessMode>).

See Backing fields for more information and examples.

Applies to

Продукт Версии
Entity Framework Core 5.0, 6.0, 7.0, 8.0, 9.0