Interface IClrCollectionAccessor
- Namespace
- Microsoft.EntityFrameworkCore.Metadata
- Assembly
- Microsoft.EntityFrameworkCore.dll
Represents operations backed by compiled delegates that allow manipulation of collections on navigation properties.
This type is typically used by database providers (and other extensions). It is generally not used in application code.
public interface IClrCollectionAccessor
Remarks
See Implementation of database providers and extensions for more information and examples.
Properties
CollectionType
The collection type.
Type CollectionType { get; }
Property Value
Methods
Add(object, object, bool)
Adds a value to the navigation property collection, unless it is already contained in the collection.
bool Add(object entity, object value, bool forMaterialization)
Parameters
entity
objectThe entity instance.
value
objectThe value to add.
forMaterialization
boolIf true, then the value is being added as part of query materialization.
Returns
AddStandalone(object, object)
Adds a value to the passed collection, unless it is already contained in the collection.
bool AddStandalone(object collection, object value)
Parameters
Returns
Contains(object, object)
Checks whether the value is contained in the collection.
bool Contains(object entity, object value)
Parameters
Returns
ContainsStandalone(object, object)
Checks whether the value is contained in the passed collection.
bool ContainsStandalone(object collection, object value)
Parameters
Returns
Create()
Creates a new collection instance of the appropriate type for the navigation property.
object Create()
Returns
- object
The collection instance.
GetOrCreate(object, bool)
Either returns the existing collection instance set on the navigation property, or if none exists, then creates a new instance, sets it, and returns it.
object GetOrCreate(object entity, bool forMaterialization)
Parameters
entity
objectThe entity instance.
forMaterialization
boolIf true, then this is happening as part of query materialization; false otherwise.
Returns
- object
The existing or new collection.
Remove(object, object)
Removes a value from the collection.
bool Remove(object entity, object value)
Parameters
Returns
RemoveStandalone(object?, object)
Removes a value from the passed collection.
bool RemoveStandalone(object? collection, object value)