Table of Contents

Method HasElementName

Namespace
Microsoft.EntityFrameworkCore
Assembly
MongoDB.EntityFrameworkCore.dll

HasElementName(PropertyBuilder, string)

Configures the document element that the property is mapped to when targeting MongoDB.

public static PropertyBuilder HasElementName(this PropertyBuilder propertyBuilder, string name)

Parameters

propertyBuilder PropertyBuilder

The builder for the property being configured.

name string

The element name for the property.

Returns

PropertyBuilder

The same builder instance so that multiple calls can be chained.

HasElementName<TProperty>(PropertyBuilder<TProperty>, string)

Configures the document element that the property is mapped to when targeting MongoDB.

public static PropertyBuilder<TProperty> HasElementName<TProperty>(this PropertyBuilder<TProperty> propertyBuilder, string name)

Parameters

propertyBuilder PropertyBuilder<TProperty>

The builder for the property being configured.

name string

The element name for the property.

Returns

PropertyBuilder<TProperty>

The same builder instance so that multiple calls can be chained.

Type Parameters

TProperty

The type of the property being configured.

HasElementName(IConventionPropertyBuilder, string?, bool)

Configures the document element that the property is mapped to when targeting MongoDB. If an empty string is supplied then the property will not be persisted.

public static IConventionPropertyBuilder? HasElementName(this IConventionPropertyBuilder propertyBuilder, string? name, bool fromDataAnnotation = false)

Parameters

propertyBuilder IConventionPropertyBuilder

The builder for the property being configured.

name string

The element name for the property.

fromDataAnnotation bool

Indicates whether the configuration was specified using a data annotation.

Returns

IConventionPropertyBuilder

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