コード例 #1
0
        public IFluentParameterDescriptor Parameter <TMember>(Linq.Expressions.Expression <Func <TEntity, TMember> > memberExpression)
        {
            var parameter = new DefaultFluentParameterDescriptor <TEntity, TMember>(memberExpression, _command);

            parameter.BindEntity(_reference);
            _parameters.Add(parameter);
            return(parameter);
        }
コード例 #2
0
ファイル: Extensions.cs プロジェクト: aelij/WPFToolkit
        public static string GetMemberName <T>(
            Expression <Func <T, object> > expr)
        {
            Linq.Expressions.Expression body = expr.Body;
            var memberExpression             = body as MemberExpression;

            if (memberExpression == null)
            {
                memberExpression = (MemberExpression)((UnaryExpression)body).Operand;
            }
            return(memberExpression.Member.Name);
        }
コード例 #3
0
        private static void Initialize(Linq.Expressions.Expression propertyExpression, Action action)
        {
            var propNameStack = new Stack <string>();

            while (propertyExpression is MemberExpression temp) // Gets the root of the property chain.
            {
                propertyExpression = temp.Expression;
                propNameStack.Push(temp.Member.Name); // Records the name of each property.
            }

            if (!(propertyExpression is ConstantExpression constantExpression))
            {
                throw new NotSupportedException("Operation not supported for the given expression type. " +
                                                "Only MemberExpression and ConstantExpression are currently supported.");
            }

            var propObserverNodeRoot          = new PropertyObserverNode(propNameStack.Pop(), action);
            PropertyObserverNode previousNode = propObserverNodeRoot;

            foreach (var propName in propNameStack) // Create a node chain that corresponds to the property chain.
            {
                var currentNode = new PropertyObserverNode(propName, action);
                previousNode.Next = currentNode;
                previousNode      = currentNode;
            }

            object propOwnerObject = constantExpression.Value;

            if (!(propOwnerObject is INotifyPropertyChanged inpcObject))
            {
                throw new InvalidOperationException("Trying to subscribe PropertyChanged listener in object that " +
                                                    $"owns '{propObserverNodeRoot.PropertyName}' property, but the object does not implements INotifyPropertyChanged.");
            }

            propObserverNodeRoot.SubscribeListenerFor(inpcObject);
        }
コード例 #4
0
ファイル: ExpandoObject.cs プロジェクト: PlumpMath/CIL2Java
 DynamicMetaObject IDynamicMetaObjectProvider.GetMetaObject(Linq.Expressions.Expression parameter)
 {
     throw new NotImplementedException();
 }
コード例 #5
0
 public Guid[] Where(Linq.Expressions.Expression <Func <TEntity, bool> > predicate)
 {
     return(EntityContext.Where(predicate));
 }
コード例 #6
0
 private PropertyObserver(Linq.Expressions.Expression propertyExpression, Action action)
 {
     Initialize(propertyExpression, action);
 }