I would like to build an expression that will fit the expected ...
Expression<Func<ReferencedEntity, bool>> expected = (ReferencedEntity referencedEntity) => foreignKeys.Contains(referencedEntity.Id); Expression<Func<ReferencedEntity, bool>> actual;
Type foreignKeys is a List<object>
Here is what I have so far, and I think he will use the Expression.Call () method, but not sure how to do it.
ParameterExpression entityParameter = Expression.Parameter(typeof(TReferencedEntity), "referencedEntity"); MemberExpression memberExpression = Expression.Property(entityParameter, "Id"); Expression convertExpression = Expression.Convert(memberExpression, typeof(object)); //This is becuase the memberExpression for Id returns a int. //Expression containsExpression = Expression.Call(???? //actual = Expression.Lambda<Func<TReferencedEntity, bool>>(????, entityParameter);
Thanks for the help.
source share