protected Selector <TModel, TSelector> Select(params Expression <Func <TSelector, object> >[] expressions)
        {
            foreach (var expression in expressions)
            {
                var member = (expression.Body as MemberExpression)?.Member;

                if (member == null)
                {
                    var unary = (expression.Body as UnaryExpression)?.Operand;
                    member = (unary as MemberExpression)?.Member;
                }

                if (member == null)
                {
                    continue;
                }

                if (Selections.TryGetValue(member.Name, out var selection))
                {
                    selection.IsSelected = true;
                }

                if (!SelectedProperties.ContainsKey(member.Name))
                {
                    SelectedProperties.Add(member.Name, PropertyInfoMapping[member.Name]);
                }
            }

            return(this);
        }
        public Selector <TModel, TSelector> SelectAll()
        {
            Clear();
            foreach (var pair in PropertyInfoMapping)
            {
                SelectedProperties.Add(pair.Key, pair.Value);
            }

            return(this);
        }
Exemple #3
0
 public void AddSelectedProperty(Property p)
 {
     SelectedProperties.Add(p); Save();
 }