Delen via


MutablePropertyBaseExtensions.SetField(IMutablePropertyBase, String) Method

Definition

Sets the underlying CLR field that this property should use.

Backing fields are normally found by convention as described here: http://go.microsoft.com/fwlink/?LinkId=723277. 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(IMutablePropertyBase, Nullable<PropertyAccessMode>).

public static void SetField (this Microsoft.EntityFrameworkCore.Metadata.IMutablePropertyBase property, string fieldName);
static member SetField : Microsoft.EntityFrameworkCore.Metadata.IMutablePropertyBase * string -> unit
<Extension()>
Public Sub SetField (property As IMutablePropertyBase, fieldName As String)

Parameters

property
IMutablePropertyBase

The property for which the backing field should be set.

fieldName
String

The name of the field to use.

Applies to