GetExpressionRestriction() 공개 정적인 메소드

Creates the binding restriction that checks the expression for arbitrary immutable properties.
By convention, the general restrictions created by this method must only test immutable object properties.
public static GetExpressionRestriction ( Expression expression ) : BindingRestrictions
expression System.Linq.Expressions.Expression The expression expressing the restrictions.
리턴 BindingRestrictions
    private static BindingRestrictions AddRemoteObjectRestrictions(BindingRestrictions restrictions, object[] args, ReadOnlyCollection<ParameterExpression> parameters)
    {
#if !SILVERLIGHT

        for (int i = 0; i < parameters.Count; i++)
        {
            var expr = parameters[i];
            var value = args[i] as MarshalByRefObject;

            // special case for MBR objects.
            // when MBR objects are remoted they can have different conversion behavior
            // so bindings created for local and remote objects should not be mixed.
            if (value != null && !IsComObject(value))
            {
                BindingRestrictions remotedRestriction;
                if (RemotingServices.IsObjectOutOfAppDomain(value))
                {
                    remotedRestriction = BindingRestrictions.GetExpressionRestriction(
                                             Expression.AndAlso(
                                                 Expression.NotEqual(expr, Expression.Constant(null)),
                                                 Expression.Call(
                                                     typeof(RemotingServices).GetMethod("IsObjectOutOfAppDomain"),
                                                     expr
                                                 )
                                             )
                                         );
                }
                else
                {
                    remotedRestriction = BindingRestrictions.GetExpressionRestriction(
                                             Expression.AndAlso(
                                                 Expression.NotEqual(expr, Expression.Constant(null)),
                                                 Expression.Not(
                                                     Expression.Call(
                                                         typeof(RemotingServices).GetMethod("IsObjectOutOfAppDomain"),
                                                         expr
                                                     )
                                                 )
                                             )
                                         );
                }
                restrictions = restrictions.Merge(remotedRestriction);
            }
        }

#endif
        return restrictions;
    }
 private static BindingRestrictions AddRemoteObjectRestrictions(BindingRestrictions restrictions, object[] args, ReadOnlyCollection <ParameterExpression> parameters)
 {
     for (int i = 0; i < parameters.Count; i++)
     {
         ParameterExpression left = parameters[i];
         MarshalByRefObject  obj2 = args[i] as MarshalByRefObject;
         if ((obj2 != null) && !IsComObject(obj2))
         {
             BindingRestrictions expressionRestriction;
             if (RemotingServices.IsObjectOutOfAppDomain(obj2))
             {
                 expressionRestriction = BindingRestrictions.GetExpressionRestriction(Expression.AndAlso(Expression.NotEqual(left, Expression.Constant(null)), Expression.Call(typeof(RemotingServices).GetMethod("IsObjectOutOfAppDomain"), left)));
             }
             else
             {
                 expressionRestriction = BindingRestrictions.GetExpressionRestriction(Expression.AndAlso(Expression.NotEqual(left, Expression.Constant(null)), Expression.Not(Expression.Call(typeof(RemotingServices).GetMethod("IsObjectOutOfAppDomain"), left))));
             }
             restrictions = restrictions.Merge(expressionRestriction);
         }
     }
     return(restrictions);
 }
예제 #3
0
 public static DynamicMetaObject ToMetaObjectWithValue(this Expression expression, Expression exp, object value)
 => new DynamicMetaObject(expression, BindingRestrictions.GetExpressionRestriction(exp), value);
예제 #4
0
 public static DynamicMetaObject ToMetaObject(this Expression expression, Expression exp)
 => new DynamicMetaObject(expression, BindingRestrictions.GetExpressionRestriction(exp));