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
propertyBuilderPropertyBuilderThe builder for the property being configured.
namestringThe 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
propertyBuilderPropertyBuilder<TProperty>The builder for the property being configured.
namestringThe element name for the property.
Returns
- PropertyBuilder<TProperty>
The same builder instance so that multiple calls can be chained.
Type Parameters
TPropertyThe 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
propertyBuilderIConventionPropertyBuilderThe builder for the property being configured.
namestringThe element name for the property.
fromDataAnnotationboolIndicates whether the configuration was specified using a data annotation.
Returns
- IConventionPropertyBuilder
The same builder instance if the configuration was applied, null otherwise.