Property<TProperty>(Object, String) Method
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
References a given property or navigation on an entity instance. This is useful for shadow state properties, for which no CLR property exists. 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.
Note that this is a static method accessed through the top-level EF static type.
public static TProperty Property<TProperty> (object entity, string propertyName);
static member Property : obj * string -> 'Property
Public Shared Function Property(Of TProperty) (entity As Object, propertyName As String) As TProperty
The type of the property being referenced.
The entity to access the property on.
The name of the property.
The value assigned to the property.
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));
See Using EF.Property in EF Core queries for more information.
Submit and view feedback for