public SanityMutationBuilder <TDoc> PatchByQuery(SanityPatchByQuery <TDoc> patchByQuery) { lock (GetLock()) { InnerBuilder.Mutations.Add(new SanityPatchMutation(patchByQuery) { DocType = typeof(TDoc) }); return(this); } }
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); } }
//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); } }
public SanityPatchMutation(SanityPatchByQuery patch) { Patch = patch; }