Share via


ModelBuilder.UsePropertyAccessMode Method

Definition

Overloads

UsePropertyAccessMode(PropertyAccessMode)

Sets the PropertyAccessMode to use for all properties of this entity type.

By default, the backing field, if one is found by convention 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. Calling this method witll change that behavior for all properties in the model as described in the PropertyAccessMode enum.

UsePropertyAccessMode(PropertyAccessMode)

Sets the PropertyAccessMode to use for all properties of this entity type.

UsePropertyAccessMode(PropertyAccessMode)

Sets the PropertyAccessMode to use for all properties of this entity type.

By default, the backing field, if one is found by convention 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. Calling this method witll change that behavior for all properties in the model as described in the PropertyAccessMode enum.

public virtual Microsoft.EntityFrameworkCore.ModelBuilder UsePropertyAccessMode (Microsoft.EntityFrameworkCore.Metadata.PropertyAccessMode propertyAccessMode);
abstract member UsePropertyAccessMode : Microsoft.EntityFrameworkCore.Metadata.PropertyAccessMode -> Microsoft.EntityFrameworkCore.ModelBuilder
override this.UsePropertyAccessMode : Microsoft.EntityFrameworkCore.Metadata.PropertyAccessMode -> Microsoft.EntityFrameworkCore.ModelBuilder
Public Overridable Function UsePropertyAccessMode (propertyAccessMode As PropertyAccessMode) As ModelBuilder

Parameters

propertyAccessMode
PropertyAccessMode

The PropertyAccessMode to use for properties of this model.

Returns

The same ModelBuilder instance so that additional configuration calls can be chained.

Applies to

UsePropertyAccessMode(PropertyAccessMode)

Source:
ModelBuilder.cs
Source:
ModelBuilder.cs
Source:
ModelBuilder.cs
Source:
ModelBuilder.cs
Source:
ModelBuilder.cs
Source:
ModelBuilder.cs
Source:
ModelBuilder.cs
Source:
ModelBuilder.cs
Source:
ModelBuilder.cs

Sets the PropertyAccessMode to use for all properties of this entity type.

public virtual Microsoft.EntityFrameworkCore.ModelBuilder UsePropertyAccessMode (Microsoft.EntityFrameworkCore.PropertyAccessMode propertyAccessMode);
abstract member UsePropertyAccessMode : Microsoft.EntityFrameworkCore.PropertyAccessMode -> Microsoft.EntityFrameworkCore.ModelBuilder
override this.UsePropertyAccessMode : Microsoft.EntityFrameworkCore.PropertyAccessMode -> Microsoft.EntityFrameworkCore.ModelBuilder
Public Overridable Function UsePropertyAccessMode (propertyAccessMode As PropertyAccessMode) As ModelBuilder

Parameters

propertyAccessMode
PropertyAccessMode

The PropertyAccessMode to use for properties of this model.

Returns

The same ModelBuilder instance so that additional configuration calls can be chained.

Remarks

By default, the backing field, if one is found by convention 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. Calling this method will change that behavior for all properties in the model as described in the PropertyAccessMode enum.

See Property versus field access in EF Core for more information and examples.

Applies to