示例#1
0
        internal R Update <R>(IUpdateable updateable, 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(updateable.Query.Expression, true, log) !;

                    var binder = new QueryBinder(aliasGenerator);
                    log.Switch("Bind");
                    CommandExpression update           = binder.BindUpdate(cleaned, updateable.PartSelector, updateable.SetterExpressions);
                    CommandExpression updateOptimized  = (CommandExpression)Optimize(update, binder, aliasGenerator, log);
                    CommandExpression updateSimplified = CommandSimplifier.Simplify(updateOptimized, removeSelectRowCount, aliasGenerator);
                    log.Switch("TR");
                    cr = TranslatorBuilder.BuildCommandResult(updateSimplified);
                }
            return(continuation(cr));
        }