My server provides special $-prefixed identifiers that clients can use in their queries. I'd like to make these identifiers available in LINQ queries via strongly typed static fields however PartialEvaluatingExpressionTreeVisitor keeps trying to evaluate
them. What's the best way to bypass the evaluation of MemberExpression instances that point to my special fields?
var
results = new
MyQueryable<Contact>()
.Where(c => ServerVariable.Key !=
"0001" &&
ServerVariable.Updated <
new
DateTime(2012, 1, 1))
.ToList();
public
static
class
ServerVariable
{
public
static
readonly
ServerVariable<string>
Key = new
ServerVariable<string>("$key");
public
static
readonly
ServerVariable<DateTime>
Updated = new
ServerVariable<DateTime>("$updated");
}
public
class
ServerVariable<T>
{
private
readonly
string _name;
public ServerVariable(string
name)
{
_name = name;
}
public
string Name
{
get {
return _name; }
}
public
static
implicit
operator
ServerVariable<T>(T value)
{
throw
new
NotSupportedException();
}
public
static
implicit
operator T(ServerVariable<T>
value)
{
throw
new
NotSupportedException();
}
}
--
You received this message because you are subscribed to the Google Groups "re-motion Users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/re-motion-users/-/2KsbqHJ9m-0J.
To post to this group, send email to
re-moti...@googlegroups.com.
To unsubscribe from this group, send email to
re-motion-use...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/re-motion-users?hl=en.