EntityFramework-Plus icon indicating copy to clipboard operation
EntityFramework-Plus copied to clipboard

Getting the SQL statement for an Update, Insert, or Delete query

Open fschmied opened this issue 5 years ago • 4 comments

When using "normal" EF 6 LINQ queries, one can obtain the SELECT SQL for them by either calling ToString() (without parameter values) or by getting the underlying object query (with parameter values).

Is something similar possible with EF-Plus's Update, Insert, or Delete queries? I.e., not executing them immediately, but getting the actual DB command including parameters?

I'd like to collect a number of individual queries and batch them together into a single DB roundtrip. Getting the command without executing it would be a simple way to solve this.

fschmied avatar May 24 '19 12:05 fschmied

Hello @fschmied ,

This features will be eventually implemented since we understand the value here. But at this moment, we, unfortunately, don't have the time for such thing ;(

Best Regards,

Jonathan


Performance Libraries context.BulkInsert(list, options => options.BatchSize = 1000); Entity Framework ExtensionsEntity Framework ClassicBulk OperationsDapper Plus

Runtime Evaluation Eval.Execute("x + y", new {x = 1, y = 2}); // return 3 C# Eval FunctionSQL Eval Function

JonathanMagnan avatar May 24 '19 13:05 JonathanMagnan

I understand. Would you accept a PR of I created one? I'd simply extract the relevant code from BatchUpdate.Execute etc. into a public CreateCommand method.

fschmied avatar May 24 '19 14:05 fschmied

Sure @fschmied ,

We are always open for some help :)

JonathanMagnan avatar May 28 '19 02:05 JonathanMagnan

Okay, great! I'll see to it when we actually build the feature in our application that needs batched update/insert/delete statements.

fschmied avatar May 28 '19 08:05 fschmied