MutableEntityTypeExtensions MutableEntityTypeExtensions Class

Extension methods for IMutableEntityType.

Syntax

Declaration

public static class MutableEntityTypeExtensionsPublic Module MutableEntityTypeExtensions

Inheritance Hierarchy

  • System.Object
    System.Object
  • MutableEntityTypeExtensions
    MutableEntityTypeExtensions

Inherited Members

ToString(),
ToString(),
Equals(Object),
Equals(Object),
Equals(Object, Object),
Equals(Object, Object),
ReferenceEquals(Object, Object),
ReferenceEquals(Object, Object),
GetHashCode(),
GetHashCode(),
GetType(),
GetType(),
MemberwiseClone()
MemberwiseClone()

Methods summary

Adds a new relationship to this entity.

Adds an index to this entity.

Adds a new alternate key to this entity type.

Adds a property to this entity.

Gets the foreign key for the given properties that points to a given primary or alternate key. Returns null if no foreign key is found.

Gets the foreign keys defined on the given property. Only foreign keys that are defined on exactly the specified property are returned. Composite foreign keys that include the specified property are not returned.

Gets the foreign keys defined on the given properties. Only foreign keys that are defined on exactly the specified set of properties are returned.

Gets the index defined on the given property. Returns null if no index is defined.

Gets the primary or alternate key that is defined on the given property. Returns null if no key is defined for the given property.

Gets a navigation property on the given entity type. Returns null if no navigation property is found.

Gets a navigation property on the given entity type. Returns null if no navigation property is found.

Gets a property on the given entity type. Returns null if no property is found.

This API only finds scalar properties and does not find navigation properties. Use FindNavigation(IMutableEntityType, PropertyInfo) to find a navigation property.

Gets all types in the model that derive from a given entity type.

Gets all navigation properties on the given entity type.

Gets an existing relationship, or creates a new one if one is not already defined.

Gets an existing relationship, or creates a new one if one is not already defined.

Gets the index defined on the given property or creates a new one if one is not already defined.

Gets the index defined on the given property or creates a new one if one is not already defined.

Gets the existing alternate key defined on a property, or creates a new one if one is not already defined.

Gets the existing alternate key defined on a set of properties, or creates a new one if one is not already defined.

Gets the property with the given name, or creates a new one if one is not already defined.

Gets the property with the given name, or creates a new one if one is not already defined.

Gets the existing primary key of an entity, or sets it if one is not defined.

Gets the existing primary key of an entity, or sets it if one is not defined.

Gets all foreign keys that target a given entity type (i.e. foreign keys where the given entity type is the principal).

Gets the root base type for a given entity type.

Sets the primary key for this entity.

Sets the PropertyAccessMode to use for properties of this entity type.

Note that individual properties can override this access mode. The value set here will be used for any property for which no override has been specified.

Methods

  • AddForeignKey(IMutableEntityType, IMutableProperty, IMutableKey, IMutableEntityType)
    AddForeignKey(IMutableEntityType, IMutableProperty, IMutableKey, IMutableEntityType)

    Adds a new relationship to this entity.

    public static IMutableForeignKey AddForeignKey(this IMutableEntityType entityType, IMutableProperty property, IMutableKey principalKey, IMutableEntityType principalEntityType)<ExtensionAttribute>
    Public Shared Function AddForeignKey(entityType As IMutableEntityType, property As IMutableProperty, principalKey As IMutableKey, principalEntityType As IMutableEntityType) As IMutableForeignKey

    Parameters

    Returns

  • AddIndex(IMutableEntityType, IMutableProperty)
    AddIndex(IMutableEntityType, IMutableProperty)

    Adds an index to this entity.

    public static IMutableIndex AddIndex(this IMutableEntityType entityType, IMutableProperty property)<ExtensionAttribute>
    Public Shared Function AddIndex(entityType As IMutableEntityType, property As IMutableProperty) As IMutableIndex

    Parameters

    Returns

  • AddKey(IMutableEntityType, IMutableProperty)
    AddKey(IMutableEntityType, IMutableProperty)

    Adds a new alternate key to this entity type.

    public static IMutableKey AddKey(this IMutableEntityType entityType, IMutableProperty property)<ExtensionAttribute>
    Public Shared Function AddKey(entityType As IMutableEntityType, property As IMutableProperty) As IMutableKey

    Parameters

    Returns

  • AddProperty(IMutableEntityType, PropertyInfo)
    AddProperty(IMutableEntityType, PropertyInfo)

    Adds a property to this entity.

    public static IMutableProperty AddProperty(this IMutableEntityType entityType, PropertyInfo propertyInfo)<ExtensionAttribute>
    Public Shared Function AddProperty(entityType As IMutableEntityType, propertyInfo As PropertyInfo) As IMutableProperty

    Parameters

    • entityType

      The entity type to add the property to.

    • propertyInfo
      System.Reflection.PropertyInfo
      System.Reflection.PropertyInfo

      The corresponding property in the entity class.

    Returns

  • FindForeignKey(IMutableEntityType, IProperty, IKey, IEntityType)
    FindForeignKey(IMutableEntityType, IProperty, IKey, IEntityType)

    Gets the foreign key for the given properties that points to a given primary or alternate key. Returns null if no foreign key is found.

    public static IMutableForeignKey FindForeignKey(this IMutableEntityType entityType, IProperty property, IKey principalKey, IEntityType principalEntityType)<ExtensionAttribute>
    Public Shared Function FindForeignKey(entityType As IMutableEntityType, property As IProperty, principalKey As IKey, principalEntityType As IEntityType) As IMutableForeignKey

    Parameters

    • entityType

      The entity type to find the foreign keys on.

    • property

      The property that the foreign key is defined on.

    • principalKey

      The primary or alternate key that is referenced.

    • principalEntityType

      The entity type that the relationship targets. This may be different from the type that principalKey is defined on when the relationship targets a derived type in an inheritance hierarchy (since the key is defined on the base type of the hierarchy).

    Returns

  • FindForeignKeys(IMutableEntityType, IProperty)
    FindForeignKeys(IMutableEntityType, IProperty)

    Gets the foreign keys defined on the given property. Only foreign keys that are defined on exactly the specified property are returned. Composite foreign keys that include the specified property are not returned.

    public static IEnumerable<IMutableForeignKey> FindForeignKeys(this IMutableEntityType entityType, IProperty property)<ExtensionAttribute>
    Public Shared Function FindForeignKeys(entityType As IMutableEntityType, property As IProperty) As IEnumerable(Of IMutableForeignKey)

    Parameters

    Returns

  • FindForeignKeys(IMutableEntityType, IReadOnlyList<IProperty>)
    FindForeignKeys(IMutableEntityType, IReadOnlyList(Of IProperty))

    Gets the foreign keys defined on the given properties. Only foreign keys that are defined on exactly the specified set of properties are returned.

    public static IEnumerable<IMutableForeignKey> FindForeignKeys(this IMutableEntityType entityType, IReadOnlyList<IProperty> properties)<ExtensionAttribute>
    Public Shared Function FindForeignKeys(entityType As IMutableEntityType, properties As IReadOnlyList(Of IProperty)) As IEnumerable(Of IMutableForeignKey)

    Parameters

    Returns

  • FindIndex(IMutableEntityType, IProperty)
    FindIndex(IMutableEntityType, IProperty)

    Gets the index defined on the given property. Returns null if no index is defined.

    public static IMutableIndex FindIndex(this IMutableEntityType entityType, IProperty property)<ExtensionAttribute>
    Public Shared Function FindIndex(entityType As IMutableEntityType, property As IProperty) As IMutableIndex

    Parameters

    Returns

  • FindKey(IMutableEntityType, IProperty)
    FindKey(IMutableEntityType, IProperty)

    Gets the primary or alternate key that is defined on the given property. Returns null if no key is defined for the given property.

    public static IMutableKey FindKey(this IMutableEntityType entityType, IProperty property)<ExtensionAttribute>
    Public Shared Function FindKey(entityType As IMutableEntityType, property As IProperty) As IMutableKey

    Parameters

    Returns

  • FindNavigation(IMutableEntityType, PropertyInfo)
    FindNavigation(IMutableEntityType, PropertyInfo)

    Gets a navigation property on the given entity type. Returns null if no navigation property is found.

    public static IMutableNavigation FindNavigation(this IMutableEntityType entityType, PropertyInfo propertyInfo)<ExtensionAttribute>
    Public Shared Function FindNavigation(entityType As IMutableEntityType, propertyInfo As PropertyInfo) As IMutableNavigation

    Parameters

    • entityType

      The entity type to find the navigation property on.

    • propertyInfo
      System.Reflection.PropertyInfo
      System.Reflection.PropertyInfo

      The navigation property on the entity class.

    Returns

  • FindNavigation(IMutableEntityType, String)
    FindNavigation(IMutableEntityType, String)

    Gets a navigation property on the given entity type. Returns null if no navigation property is found.

    public static IMutableNavigation FindNavigation(this IMutableEntityType entityType, string name)<ExtensionAttribute>
    Public Shared Function FindNavigation(entityType As IMutableEntityType, name As String) As IMutableNavigation

    Parameters

    • entityType

      The entity type to find the navigation property on.

    • name
      System.String
      System.String

      The name of the navigation property on the entity class.

    Returns

  • FindProperty(IMutableEntityType, PropertyInfo)
    FindProperty(IMutableEntityType, PropertyInfo)

    Gets a property on the given entity type. Returns null if no property is found.

    This API only finds scalar properties and does not find navigation properties. Use FindNavigation(IMutableEntityType, PropertyInfo) to find a navigation property.

    public static IMutableProperty FindProperty(this IMutableEntityType entityType, PropertyInfo propertyInfo)<ExtensionAttribute>
    Public Shared Function FindProperty(entityType As IMutableEntityType, propertyInfo As PropertyInfo) As IMutableProperty

    Parameters

    • entityType

      The entity type to find the property on.

    • propertyInfo
      System.Reflection.PropertyInfo
      System.Reflection.PropertyInfo

      The property on the entity class.

    Returns

  • GetDerivedTypes(IMutableEntityType)
    GetDerivedTypes(IMutableEntityType)

    Gets all types in the model that derive from a given entity type.

    public static IEnumerable<IMutableEntityType> GetDerivedTypes(this IMutableEntityType entityType)<ExtensionAttribute>
    Public Shared Function GetDerivedTypes(entityType As IMutableEntityType) As IEnumerable(Of IMutableEntityType)

    Parameters

    Returns

  • GetNavigations(IMutableEntityType)
    GetNavigations(IMutableEntityType)

    Gets all navigation properties on the given entity type.

    public static IEnumerable<IMutableNavigation> GetNavigations(this IMutableEntityType entityType)<ExtensionAttribute>
    Public Shared Function GetNavigations(entityType As IMutableEntityType) As IEnumerable(Of IMutableNavigation)

    Parameters

    Returns

    • System.Collections.Generic.IEnumerable<T><IMutableNavigation>
      System.Collections.Generic.IEnumerable<T>(Of IMutableNavigation)

      All navigation properties on the given entity type.

  • GetOrAddForeignKey(IMutableEntityType, IMutableProperty, IMutableKey, IMutableEntityType)
    GetOrAddForeignKey(IMutableEntityType, IMutableProperty, IMutableKey, IMutableEntityType)

    Gets an existing relationship, or creates a new one if one is not already defined.

    public static IMutableForeignKey GetOrAddForeignKey(this IMutableEntityType entityType, IMutableProperty property, IMutableKey principalKey, IMutableEntityType principalEntityType)<ExtensionAttribute>
    Public Shared Function GetOrAddForeignKey(entityType As IMutableEntityType, property As IMutableProperty, principalKey As IMutableKey, principalEntityType As IMutableEntityType) As IMutableForeignKey

    Parameters

    Returns

  • GetOrAddForeignKey(IMutableEntityType, IReadOnlyList<IMutableProperty>, IMutableKey, IMutableEntityType)
    GetOrAddForeignKey(IMutableEntityType, IReadOnlyList(Of IMutableProperty), IMutableKey, IMutableEntityType)

    Gets an existing relationship, or creates a new one if one is not already defined.

    public static IMutableForeignKey GetOrAddForeignKey(this IMutableEntityType entityType, IReadOnlyList<IMutableProperty> properties, IMutableKey principalKey, IMutableEntityType principalEntityType)<ExtensionAttribute>
    Public Shared Function GetOrAddForeignKey(entityType As IMutableEntityType, properties As IReadOnlyList(Of IMutableProperty), principalKey As IMutableKey, principalEntityType As IMutableEntityType) As IMutableForeignKey

    Parameters

    • entityType

      The entity type to get or add the foreign key to.

    • properties
      System.Collections.Generic.IReadOnlyList<T><IMutableProperty>
      System.Collections.Generic.IReadOnlyList<T>(Of IMutableProperty)

      The properties that the foreign key is defined on.

    • principalKey

      The primary or alternate key that is referenced.

    • principalEntityType

      The entity type that the relationship targets. This may be different from the type that principalKey is defined on when the relationship targets a derived type in an inheritance hierarchy (since the key is defined on the base type of the hierarchy).

    Returns

  • GetOrAddIndex(IMutableEntityType, IMutableProperty)
    GetOrAddIndex(IMutableEntityType, IMutableProperty)

    Gets the index defined on the given property or creates a new one if one is not already defined.

    public static IMutableIndex GetOrAddIndex(this IMutableEntityType entityType, IMutableProperty property)<ExtensionAttribute>
    Public Shared Function GetOrAddIndex(entityType As IMutableEntityType, property As IMutableProperty) As IMutableIndex

    Parameters

    Returns

  • GetOrAddIndex(IMutableEntityType, IReadOnlyList<IMutableProperty>)
    GetOrAddIndex(IMutableEntityType, IReadOnlyList(Of IMutableProperty))

    Gets the index defined on the given property or creates a new one if one is not already defined.

    public static IMutableIndex GetOrAddIndex(this IMutableEntityType entityType, IReadOnlyList<IMutableProperty> properties)<ExtensionAttribute>
    Public Shared Function GetOrAddIndex(entityType As IMutableEntityType, properties As IReadOnlyList(Of IMutableProperty)) As IMutableIndex

    Parameters

    Returns

  • GetOrAddKey(IMutableEntityType, IMutableProperty)
    GetOrAddKey(IMutableEntityType, IMutableProperty)

    Gets the existing alternate key defined on a property, or creates a new one if one is not already defined.

    public static IMutableKey GetOrAddKey(this IMutableEntityType entityType, IMutableProperty property)<ExtensionAttribute>
    Public Shared Function GetOrAddKey(entityType As IMutableEntityType, property As IMutableProperty) As IMutableKey

    Parameters

    Returns

  • GetOrAddKey(IMutableEntityType, IReadOnlyList<IMutableProperty>)
    GetOrAddKey(IMutableEntityType, IReadOnlyList(Of IMutableProperty))

    Gets the existing alternate key defined on a set of properties, or creates a new one if one is not already defined.

    public static IMutableKey GetOrAddKey(this IMutableEntityType entityType, IReadOnlyList<IMutableProperty> properties)<ExtensionAttribute>
    Public Shared Function GetOrAddKey(entityType As IMutableEntityType, properties As IReadOnlyList(Of IMutableProperty)) As IMutableKey

    Parameters

    Returns

  • GetOrAddProperty(IMutableEntityType, PropertyInfo)
    GetOrAddProperty(IMutableEntityType, PropertyInfo)

    Gets the property with the given name, or creates a new one if one is not already defined.

    public static IMutableProperty GetOrAddProperty(this IMutableEntityType entityType, PropertyInfo propertyInfo)<ExtensionAttribute>
    Public Shared Function GetOrAddProperty(entityType As IMutableEntityType, propertyInfo As PropertyInfo) As IMutableProperty

    Parameters

    • entityType

      The entity type to get or add the property to.

    • propertyInfo
      System.Reflection.PropertyInfo
      System.Reflection.PropertyInfo

      The corresponding property in the entity class.

    Returns

    Remarks

    The returned property might not have the specified type and shadowness.

  • GetOrAddProperty(IMutableEntityType, String, Type)
    GetOrAddProperty(IMutableEntityType, String, Type)

    Gets the property with the given name, or creates a new one if one is not already defined.

    public static IMutableProperty GetOrAddProperty(this IMutableEntityType entityType, string name, Type propertyType)<ExtensionAttribute>
    Public Shared Function GetOrAddProperty(entityType As IMutableEntityType, name As String, propertyType As Type) As IMutableProperty

    Parameters

    • entityType

      The entity type to get or add the property to.

    • name
      System.String
      System.String

      The name of the property.

    • propertyType
      System.Type
      System.Type

      The type of value the property will hold.

    Returns

    Remarks

    The returned property might not have the specified type and shadowness.

  • GetOrSetPrimaryKey(IMutableEntityType, IMutableProperty)
    GetOrSetPrimaryKey(IMutableEntityType, IMutableProperty)

    Gets the existing primary key of an entity, or sets it if one is not defined.

    public static IMutableKey GetOrSetPrimaryKey(this IMutableEntityType entityType, IMutableProperty property)<ExtensionAttribute>
    Public Shared Function GetOrSetPrimaryKey(entityType As IMutableEntityType, property As IMutableProperty) As IMutableKey

    Parameters

    Returns

  • GetOrSetPrimaryKey(IMutableEntityType, IReadOnlyList<IMutableProperty>)
    GetOrSetPrimaryKey(IMutableEntityType, IReadOnlyList(Of IMutableProperty))

    Gets the existing primary key of an entity, or sets it if one is not defined.

    public static IMutableKey GetOrSetPrimaryKey(this IMutableEntityType entityType, IReadOnlyList<IMutableProperty> properties)<ExtensionAttribute>
    Public Shared Function GetOrSetPrimaryKey(entityType As IMutableEntityType, properties As IReadOnlyList(Of IMutableProperty)) As IMutableKey

    Parameters

    Returns

  • GetReferencingForeignKeys(IMutableEntityType)
    GetReferencingForeignKeys(IMutableEntityType)

    Gets all foreign keys that target a given entity type (i.e. foreign keys where the given entity type is the principal).

    public static IEnumerable<IMutableForeignKey> GetReferencingForeignKeys(this IMutableEntityType entityType)<ExtensionAttribute>
    Public Shared Function GetReferencingForeignKeys(entityType As IMutableEntityType) As IEnumerable(Of IMutableForeignKey)

    Parameters

    Returns

    • System.Collections.Generic.IEnumerable<T><IMutableForeignKey>
      System.Collections.Generic.IEnumerable<T>(Of IMutableForeignKey)

      The foreign keys that reference the given entity type.

  • RootType(IMutableEntityType)
    RootType(IMutableEntityType)

    Gets the root base type for a given entity type.

    public static IMutableEntityType RootType(this IMutableEntityType entityType)<ExtensionAttribute>
    Public Shared Function RootType(entityType As IMutableEntityType) As IMutableEntityType

    Parameters

    Returns

  • SetPrimaryKey(IMutableEntityType, IMutableProperty)
    SetPrimaryKey(IMutableEntityType, IMutableProperty)

    Sets the primary key for this entity.

    public static IMutableKey SetPrimaryKey(this IMutableEntityType entityType, IMutableProperty property)<ExtensionAttribute>
    Public Shared Function SetPrimaryKey(entityType As IMutableEntityType, property As IMutableProperty) As IMutableKey

    Parameters

    Returns

  • SetPropertyAccessMode(IMutableEntityType, Nullable<PropertyAccessMode>)
    SetPropertyAccessMode(IMutableEntityType, Nullable(Of PropertyAccessMode))

    Sets the PropertyAccessMode to use for properties of this entity type.

    Note that individual properties can override this access mode. The value set here will be used for any property for which no override has been specified.

    public static void SetPropertyAccessMode(this IMutableEntityType entityType, PropertyAccessMode? propertyAccessMode)<ExtensionAttribute>
    Public Shared Sub SetPropertyAccessMode(entityType As IMutableEntityType, propertyAccessMode As PropertyAccessMode?)

    Parameters

Details

Assembly

Microsoft.EntityFrameworkCore.dll