예제 #1
0
        public UpdateBuilder <T> Set(Expression <Func <T, object> > select, Assignment.CounterModifierTypes counterModifierType, object value)
        {
            string selection = BuilderHelper.ParseSimpleMemberAccess(select);

            if (selection != null)
            {
                CurrentQuery.Assignments.Add(new Assignment(selection, counterModifierType, GenerateBindMarker(value)));
            }

            return(this);
        }
예제 #2
0
        private void BaseAlterSet <TItem>(Expression <Func <T, ISet <TItem> > > select, ISet <TItem> values, Assignment.CollectionModifierTypes modifierType)
        {
            string selection = BuilderHelper.ParseSimpleMemberAccess(select);

            if (values != null &&
                selection != null)
            {
                ISet <Term> translatedList = new HashSet <Term>();

                foreach (TItem value in values)
                {
                    translatedList.Add(GenerateBindMarker(value));
                }

                CollectionLiteral literal = new CollectionLiteral(translatedList);

                CurrentQuery.Assignments.Add(new Assignment(selection, modifierType, literal));
            }
        }
예제 #3
0
        public UpdateBuilder <T> AddToMap <TKey, TValue>(Expression <Func <T, IDictionary <TKey, TValue> > > select, IDictionary <TKey, TValue> values)
        {
            string selection = BuilderHelper.ParseSimpleMemberAccess(select);

            if (selection != null &&
                values != null)
            {
                IDictionary <Term, Term> translated = new Dictionary <Term, Term>();

                foreach (KeyValuePair <TKey, TValue> value in values)
                {
                    translated.Add(GenerateBindMarker(value.Key), GenerateBindMarker(value.Value));
                }

                CollectionLiteral literal = new CollectionLiteral(translated);

                CurrentQuery.Assignments.Add(new Assignment(selection, Assignment.CollectionModifierTypes.Add, literal));
            }

            return(this);
        }
예제 #4
0
        public UpdateBuilder <T> RemoveFromMap <TKey, TValue>(Expression <Func <T, IDictionary <TKey, TValue> > > select, ISet <TKey> keys)
        {
            string selection = BuilderHelper.ParseSimpleMemberAccess(select);

            if (keys != null &&
                selection != null)
            {
                ISet <Term> translatedList = new HashSet <Term>();

                foreach (TKey value in keys)
                {
                    translatedList.Add(GenerateBindMarker(value));
                }

                CollectionLiteral literal = new CollectionLiteral(translatedList);

                CurrentQuery.Assignments.Add(new Assignment(selection, Assignment.CollectionModifierTypes.Remove, literal));
            }

            return(this);
        }