Пример #1
0
 public SanityMutationBuilder <TDoc> PatchByQuery(SanityPatchByQuery <TDoc> patchByQuery)
 {
     lock (GetLock())
     {
         InnerBuilder.Mutations.Add(new SanityPatchMutation(patchByQuery)
         {
             DocType = typeof(TDoc)
         });
         return(this);
     }
 }
Пример #2
0
 internal SanityMutationBuilder <TDoc> PatchByQuery(Expression query, Action <SanityPatch> patch)
 {
     lock (GetLock())
     {
         var oPatch = new SanityPatchByQuery <TDoc>(query);
         patch.Invoke(oPatch);
         InnerBuilder.Mutations.Add(new SanityPatchMutation(oPatch)
         {
             DocType = typeof(TDoc)
         });
         return(this);
     }
 }
Пример #3
0
        //public SanityTransactionBuilder<TDoc> PatchByQuery(Expression<Func<TDoc, bool>> query, object patch)
        //{
        //    lock (GetLock())
        //    {
        //        var sPatch = JsonConvert.SerializeObject(patch);
        //        var oPatch = JsonConvert.DeserializeObject<SanityPatchByQuery<TDoc>>(sPatch);
        //        var parser = new SanityExpressionParser(query, typeof(TDoc));
        //        var sQuery = parser.BuildQuery();
        //        oPatch.Query = sQuery;
        //        InnerBuilder.Mutations.Add(new SanityPatchMutation(oPatch) { DocType = typeof(TDoc) });
        //        return this;
        //    }
        //}

        public SanityMutationBuilder <TDoc> PatchByQuery(Expression <Func <TDoc, bool> > query, Action <SanityPatch> patch)
        {
            lock (GetLock())
            {
                var oPatch = new SanityPatchByQuery <TDoc>(query);
                patch.Invoke(oPatch);
                var parser = new SanityExpressionParser(query, typeof(TDoc));
                InnerBuilder.Mutations.Add(new SanityPatchMutation(oPatch)
                {
                    DocType = typeof(TDoc)
                });
                return(this);
            }
        }
Пример #4
0
 public SanityPatchMutation(SanityPatchByQuery patch)
 {
     Patch = patch;
 }