EF EF Class

Static methods that are useful in application code where there is not an EF type for the method to be accessed from. For example, referencing a shadow state property in a LINQ query.

Syntax

Declaration

public static class EFPublic Module EF

Inheritance Hierarchy

  • System.Object
    System.Object
  • EF
    EF

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

Addresses a given property on an entity instance. This is useful when you want to reference a shadow state property in a LINQ query. Currently this method can only be used in LINQ queries and can not be used to access the value assigned to a property in other scenarios.

Methods

  • Property<TProperty>(Object, String)
    Property(Of TProperty)(Object, String)

    Addresses a given property on an entity instance. This is useful when you want to reference a shadow state property in a LINQ query. Currently this method can only be used in LINQ queries and can not be used to access the value assigned to a property in other scenarios.

    public static TProperty Property<TProperty>(object entity, string propertyName)Public Shared Function Property(Of TProperty)(entity As Object, propertyName As String) As TProperty

    Parameters

    • entity
      System.Object
      System.Object

      The entity to access the property on.

    • propertyName
      System.String
      System.String

      The name of the property.

    Returns

    • TProperty
      TProperty

      The value assigned to the property.

    Example

    The following code performs a filter using the a LastUpdated shadow state property.
        var blogs = context.Blogs
            .Where(b => EF.Property<DateTime>(b, "LastUpdated") > DateTime.Now.AddDays(-5))

Details

Assembly

Microsoft.EntityFrameworkCore.dll