private static IEdmProperty GetEdmProperty(IEdmStructuredType entityType, Expression <Func <TEntity, Object> > propertyExpression) { MemberExpression property; if (propertyExpression.Body is UnaryExpression convert) { property = (MemberExpression)convert.Operand; } else { property = (MemberExpression)propertyExpression.Body; } var propertyInfo = (PropertyInfo)property.Member; return(entityType.GetPropertyIgnoreCase(propertyInfo.Name)); }