开发者

LogicalBinaryExpression to MemberExpression

开发者 https://www.devze.com 2023-02-19 11:19 出处:网络
I\'m building a repository class and my find/get/etc method accept the standard LogicalBinaryExpression (x=>开发者_如何学编程;x.something == somethingElse)

I'm building a repository class and my find/get/etc method accept the standard LogicalBinaryExpression (x=>开发者_如何学编程;x.something == somethingElse)

I want to be able to create fake out my repository and use the LogicalBinaryExpression and cast or convert it to a MemberExpression so I can use it to set the value my FakeRepository returns.

For reference here is the code for my FakeRepository.

 public TEntity First(Expression<Func<TEntity, bool>> predicate)
        {
            return Builder<TEntity>.CreateNew()
              .With(predicate, true)
              .Build();
        }
0

精彩评论

暂无评论...
验证码 换一张
取 消