Interface IMutableAnnotatable
- Namespace
- Microsoft.EntityFrameworkCore.Metadata
- Assembly
- Microsoft.EntityFrameworkCore.dll
A class that exposes annotations that can be modified. Annotations allow for arbitrary metadata to be stored on an object.
This interface is typically used by database providers (and other extensions). It is generally not used in application code.
public interface IMutableAnnotatable : IReadOnlyAnnotatable
- Inherited Members
Remarks
See Modeling entity types and relationships for more information and examples.
Properties
this[string]
Gets or sets the value of the annotation with the given name.
object? this[string name] { get; set; }
Parameters
name
stringThe name of the annotation.
Property Value
- object
The value of the existing annotation if an annotation with the specified name already exists. Otherwise, null.
Methods
AddAnnotation(string, object?)
Adds an annotation to this object. Throws if an annotation with the specified name already exists.
IAnnotation AddAnnotation(string name, object? value)
Parameters
name
stringThe name of the annotation to be added.
value
objectThe value to be stored in the annotation.
Returns
- IAnnotation
The newly added annotation.
AddAnnotations(IEnumerable<IAnnotation>)
Adds annotations to an object.
void AddAnnotations(IEnumerable<IAnnotation> annotations)
Parameters
annotations
IEnumerable<IAnnotation>The annotations to be added.
RemoveAnnotation(string)
Removes the given annotation from this object.
IAnnotation? RemoveAnnotation(string name)
Parameters
name
stringThe name of the annotation to remove.
Returns
- IAnnotation
The annotation that was removed.
SetAnnotation(string, object?)
Sets the annotation stored under the given key. Overwrites the existing annotation if an annotation with the specified name already exists.
void SetAnnotation(string name, object? value)
Parameters
name
stringThe name of the annotation to be added.
value
objectThe value to be stored in the annotation.
SetOrRemoveAnnotation(string, object?)
Sets the annotation stored under the given name. Overwrites the existing annotation if an annotation with the specified name already exists. Removes the existing annotation if null is supplied.
void SetOrRemoveAnnotation(string name, object? value)