Share via


IConventionPropertyBase.SetFieldInfo(FieldInfo, Boolean) Method

Definition

Sets the FieldInfo for the underlying CLR field that this property should use.

public System.Reflection.FieldInfo SetFieldInfo (System.Reflection.FieldInfo fieldInfo, bool fromDataAnnotation = false);
public System.Reflection.FieldInfo? SetFieldInfo (System.Reflection.FieldInfo? fieldInfo, bool fromDataAnnotation = false);
abstract member SetFieldInfo : System.Reflection.FieldInfo * bool -> System.Reflection.FieldInfo
Public Function SetFieldInfo (fieldInfo As FieldInfo, Optional fromDataAnnotation As Boolean = false) As FieldInfo

Parameters

fieldInfo
FieldInfo

The FieldInfo for the underlying CLR field to use.

fromDataAnnotation
Boolean

Indicates whether the configuration was specified using a data annotation.

Returns

The new FieldInfo.

Remarks

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>, Boolean).

Applies to