internal R Delete <R>(IQueryable query, Func <SqlPreCommandSimple, R> continuation, bool removeSelectRowCount = false) { AliasGenerator aliasGenerator = new AliasGenerator(); SqlPreCommandSimple cr; using (HeavyProfiler.Log("LINQ")) using (var log = HeavyProfiler.LogNoStackTrace("Clean")) { Expression cleaned = Clean(query.Expression, true, log) !; log.Switch("Bind"); var binder = new QueryBinder(aliasGenerator); CommandExpression delete = binder.BindDelete(cleaned); CommandExpression deleteOptimized = (CommandExpression)Optimize(delete, binder, aliasGenerator, log); CommandExpression deleteSimplified = CommandSimplifier.Simplify(deleteOptimized, removeSelectRowCount, aliasGenerator); cr = TranslatorBuilder.BuildCommandResult(deleteSimplified); } return(continuation(cr)); }