Interface IConventionAnnotatableBuilder
- Namespace
- Microsoft.EntityFrameworkCore.Metadata.Builders
- Assembly
- Microsoft.EntityFrameworkCore.dll
Provides a simple API surface for configuring an IConventionAnnotatable from conventions.
This interface is typically used by database providers (and other extensions). It is generally not used in application code.
public interface IConventionAnnotatableBuilder
Remarks
See Model building conventions for more information and examples.
Properties
Metadata
Gets the annotatable item being configured.
IConventionAnnotatable Metadata { get; }
Property Value
ModelBuilder
Gets the model builder.
IConventionModelBuilder ModelBuilder { get; }
Property Value
Methods
CanRemoveAnnotation(string, bool)
Returns a value indicating whether an annotation with the given name can be removed using this configuration source.
bool CanRemoveAnnotation(string name, bool fromDataAnnotation = false)
Parameters
name
stringThe name of the annotation to remove.
fromDataAnnotation
boolIndicates whether the configuration was specified using a data annotation.
Returns
CanSetAnnotation(string, object?, bool)
Returns a value indicating whether an annotation with the given name and value can be set from this configuration source.
bool CanSetAnnotation(string name, object? value, bool fromDataAnnotation = false)
Parameters
name
stringThe name of the annotation to be added.
value
objectThe value to be stored in the annotation.
fromDataAnnotation
boolIndicates whether the configuration was specified using a data annotation.
Returns
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.
IConventionAnnotatableBuilder? HasAnnotation(string name, object? value, bool fromDataAnnotation = false)
Parameters
name
stringThe name of the annotation to be set.
value
objectThe value to be stored in the annotation.
fromDataAnnotation
boolIndicates whether the configuration was specified using a data annotation.
Returns
- IConventionAnnotatableBuilder
An IConventionAnnotatableBuilder to continue configuration if the annotation was set, null otherwise.
HasNoAnnotation(string, bool)
Removes the annotation with the given name from this object.
IConventionAnnotatableBuilder? HasNoAnnotation(string name, bool fromDataAnnotation = false)
Parameters
name
stringThe name of the annotation to remove.
fromDataAnnotation
boolIndicates whether the configuration was specified using a data annotation.
Returns
- IConventionAnnotatableBuilder
An IConventionAnnotatableBuilder 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.
IConventionAnnotatableBuilder? HasNonNullAnnotation(string name, object? value, bool fromDataAnnotation = false)
Parameters
name
stringThe name of the annotation to be set.
value
objectThe value to be stored in the annotation. null to remove the annotations.
fromDataAnnotation
boolIndicates whether the configuration was specified using a data annotation.
Returns
- IConventionAnnotatableBuilder
An IConventionAnnotatableBuilder to continue configuration if the annotation was set or removed, null otherwise.