例如:-
// This one will be converted to SQL no problem
Expression<Func<Foo, bool>> predicate = x => x.Name = "Foo";
// This one will throw a NotSupportedException because the QueryProvider
// doesn't support reference comparisons
Expression<Func<Foo, bool>> predicate = x => x == someOtherFoo;
// This one doesn't work because the query provider can't
// handle IsAwesome()
Expression<Func<Foo, bool>> predicate = x => x.IsAwesome();
我正在寻找一种在运行前测试它的方法,最好是在与数据库隔离的自动化测试中。
我花了一些时间浏览 MSDN,试图找到如何实例化我自己的 QueryProvider,但我的 Google-fu 今天似乎让我失望了。
提前致谢!