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); }
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); }
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); }
DynamicMetaObject IDynamicMetaObjectProvider.GetMetaObject(Linq.Expressions.Expression parameter) { throw new NotImplementedException(); }
public Guid[] Where(Linq.Expressions.Expression <Func <TEntity, bool> > predicate) { return(EntityContext.Where(predicate)); }
private PropertyObserver(Linq.Expressions.Expression propertyExpression, Action action) { Initialize(propertyExpression, action); }