Table of Contents

Interface IConventionPropertyBaseBuilder<TBuilder>

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

Provides a simple API surface for configuring an IConventionPropertyBase from conventions.

This interface is typically used by database providers (and other extensions). It is generally not used in application code.

public interface IConventionPropertyBaseBuilder<TBuilder> : IConventionAnnotatableBuilder where TBuilder : IConventionPropertyBaseBuilder<TBuilder>

Type Parameters

TBuilder
Inherited Members

Remarks

See Model building conventions for more information and examples.

Properties

Metadata

Gets the property-like object being configured.

IConventionPropertyBase Metadata { get; }

Property Value

IConventionPropertyBase

Methods

CanSetField(FieldInfo?, bool)

Returns a value indicating whether the backing field can be set for this property-like object from the current configuration source.

bool CanSetField(FieldInfo? fieldInfo, bool fromDataAnnotation = false)

Parameters

fieldInfo FieldInfo

The field.

fromDataAnnotation bool

Indicates whether the configuration was specified using a data annotation.

Returns

bool

true if the backing field can be set for this property-like object.

CanSetField(string?, bool)

Returns a value indicating whether the backing field can be set for this property-like object from the current configuration source.

bool CanSetField(string? fieldName, bool fromDataAnnotation = false)

Parameters

fieldName string

The field name.

fromDataAnnotation bool

Indicates whether the configuration was specified using a data annotation.

Returns

bool

true if the backing field can be set for this property-like object.

CanSetPropertyAccessMode(PropertyAccessMode?, bool)

Returns a value indicating whether the PropertyAccessMode can be set for this property-like object from the current configuration source.

bool CanSetPropertyAccessMode(PropertyAccessMode? propertyAccessMode, bool fromDataAnnotation = false)

Parameters

propertyAccessMode PropertyAccessMode?

The PropertyAccessMode to use for this property-like object.

fromDataAnnotation bool

Indicates whether the configuration was specified using a data annotation.

Returns

bool

true if the PropertyAccessMode can be set for this property-like object.

HasAnnotation(string, object?, bool)

Sets the annotation stored under the given name. Overwrites the existing annotation if an annotation with the specified name already exists with same or lower ConfigurationSource.

TBuilder? HasAnnotation(string name, object? value, bool fromDataAnnotation = false)

Parameters

name string

The name of the annotation to be set.

value object

The value to be stored in the annotation.

fromDataAnnotation bool

Indicates whether the configuration was specified using a data annotation.

Returns

TBuilder

The same builder to continue configuration if the annotation was set, null otherwise.

HasField(FieldInfo?, bool)

Sets the backing field to use for this property-like object.

TBuilder? HasField(FieldInfo? fieldInfo, bool fromDataAnnotation = false)

Parameters

fieldInfo FieldInfo

The field.

fromDataAnnotation bool

Indicates whether the configuration was specified using a data annotation.

Returns

TBuilder

The same builder instance if the configuration was applied, null otherwise.

HasField(string?, bool)

Sets the backing field to use for this property-like object.

TBuilder? HasField(string? fieldName, bool fromDataAnnotation = false)

Parameters

fieldName string

The field name.

fromDataAnnotation bool

Indicates whether the configuration was specified using a data annotation.

Returns

TBuilder

The same builder instance if the configuration was applied, null otherwise.

HasNoAnnotation(string, bool)

Removes the annotation with the given name from this object.

TBuilder? HasNoAnnotation(string name, bool fromDataAnnotation = false)

Parameters

name string

The name of the annotation to remove.

fromDataAnnotation bool

Indicates whether the configuration was specified using a data annotation.

Returns

TBuilder

The same builder to continue configuration if the annotation was set, null otherwise.

HasNonNullAnnotation(string, object?, bool)

Sets the annotation stored under the given name. Overwrites the existing annotation if an annotation with the specified name already exists with same or lower ConfigurationSource. Removes the annotation if null value is specified.

TBuilder? HasNonNullAnnotation(string name, object? value, bool fromDataAnnotation = false)

Parameters

name string

The name of the annotation to be set.

value object

The value to be stored in the annotation. null to remove the annotations.

fromDataAnnotation bool

Indicates whether the configuration was specified using a data annotation.

Returns

TBuilder

The same builder to continue configuration if the annotation was set or removed, null otherwise.

UsePropertyAccessMode(PropertyAccessMode?, bool)

Sets the PropertyAccessMode to use for this property-like object.

TBuilder? UsePropertyAccessMode(PropertyAccessMode? propertyAccessMode, bool fromDataAnnotation = false)

Parameters

propertyAccessMode PropertyAccessMode?

The PropertyAccessMode to use for this property-like object.

fromDataAnnotation bool

Indicates whether the configuration was specified using a data annotation.

Returns

TBuilder

The same builder instance if the configuration was applied, null otherwise.