本文整理汇总了C#中System.Linq.Expressions.MemberExpression.GetValue方法的典型用法代码示例。如果您正苦于以下问题:C# MemberExpression.GetValue方法的具体用法?C# MemberExpression.GetValue怎么用?C# MemberExpression.GetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Linq.Expressions.MemberExpression
的用法示例。
在下文中一共展示了MemberExpression.GetValue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VisitMemberAccess
protected override Expression VisitMemberAccess(MemberExpression m)
{
if (m.Expression != null)
{
if (m.Expression.NodeType == ExpressionType.Constant)
{
SetValue(m.GetValue());
return m;
}
if (m.Expression.NodeType == ExpressionType.Parameter)
{
_currentKey = (m.Member.Name == "Id") ? "objectId" : m.Member.Name;
if (typeof(IParseUser).IsAssignableFrom(m.Expression.Type))
_currentKey = ParseUserContract.ResolveName(_currentKey);
if (!_where.ContainsKey(_currentKey))
{
if (m.Member is PropertyInfo && ((PropertyInfo)m.Member).PropertyType == typeof(bool))
{
_where[_currentKey] = !_inversed;
}
else
{
_where[_currentKey] = null;
}
}
return m;
}
}
throw new NotSupportedException(string.Format("The member '{0}' is not supported", m.Member.Name));
}
示例2: VisitMemberAccess
protected override Expression VisitMemberAccess(MemberExpression m)
{
if (m.Expression != null)
{
if (m.Expression.NodeType == ExpressionType.Constant)
{
SetValue(m.GetValue());
return m;
}
if (m.Expression.NodeType == ExpressionType.Parameter)
{
_currentKey = m.Member.Name;
// Use JsonProperty if it exists..
var jsonName = (Newtonsoft.Json.JsonPropertyAttribute)m.Member.GetCustomAttributes(false).FirstOrDefault(x => x is Newtonsoft.Json.JsonPropertyAttribute);
if (jsonName != null)
{
_currentKey = jsonName.PropertyName;
}
if (!_where.ContainsKey(_currentKey))
{
if (m.Member is PropertyInfo && ((PropertyInfo) m.Member).PropertyType == typeof (bool))
{
_where[_currentKey] = !_inversed;
}
else
{
_where[_currentKey] = null;
}
}
return m;
}
}
throw new NotSupportedException(string.Format("The member '{0}' is not supported", m.Member.Name));
}
示例3: ParseMemberAccess
private string ParseMemberAccess(MemberExpression memberExpression)
{
var column = _mapping.Select(_ => _.ComputeColumnStatement(memberExpression)).FirstOrDefault(_ => _ != null);
return column != null
? column.ToString()
: Parameters.Add(memberExpression.GetValue());
}