/// <summary> /// Sets the LINQ expression filter automatically applied to queries for this entity type. /// </summary> /// <param name="entityType"> The entity type to set the query filter for. </param> /// <param name="queryFilter"> The LINQ expression filter. </param> /// <param name="fromDataAnnotation"> Indicates whether the configuration was specified using a data annotation. </param> public static void SetQueryFilter( [NotNull] this IConventionEntityType entityType, [CanBeNull] LambdaExpression queryFilter, bool fromDataAnnotation = false) { Check.NotNull(entityType, nameof(entityType)); var errorMessage = entityType.CheckQueryFilter(queryFilter); if (errorMessage != null) { throw new InvalidOperationException(errorMessage); } entityType.SetAnnotation(CoreAnnotationNames.QueryFilter, queryFilter, fromDataAnnotation); }