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

Bulk update throws exception if I use Take in my query

Open HolyOne opened this issue 8 years ago • 6 comments

This code works perfectly var ems = db.Email.Where(o=>o.Email1.StartsWith("ab")); ems.UpdateFromQuery(x => new Email { stat =x.stat+1 }); but if I add .Take(10) after StartsWith, I get System.Data.SqlClient.SqlException: 'Incorrect syntax near the keyword 'TOP'.'

HolyOne avatar Nov 01 '17 08:11 HolyOne

Hello @HolyOne ,

Thank you for reporting,

I will check it today or later this week to see what's the SQL generated and if there is something we can do or not about it.

Best Regards,

Jonathan

JonathanMagnan avatar Nov 01 '17 12:11 JonathanMagnan

Hello @HolyOne ,

The issue has been fixed, it will be part of the next release (later this night or tomorrow).

Best Regards,

Jonathan

JonathanMagnan avatar Nov 09 '17 00:11 JonathanMagnan

Hello @HolyOne ,

The v1.7.7 has been released

Take should now be compatible with Batch Update

Let me know if everything is working as expected.

Best Regards,

Jonathan

JonathanMagnan avatar Nov 09 '17 01:11 JonathanMagnan

Hello @HolyOne ,

We will close this issue since it should be solved.


Help us to keep this library free: Donate

JonathanMagnan avatar Nov 21 '17 01:11 JonathanMagnan

Hi @JonathanMagnan, I got exception like this.

Version: Z.EntityFramework.Plus.EFCore 1.8.10 Command: Abc.Where(e => e.Id == id).UpdateAsync(e => new Abc{count = e.count + newCount}) Exception: Must declare the scalar variable "@__Value_1". Incorrect syntax near the keyword 'AS'

Please have a look. Thanks.

phucdat1d avatar Oct 26 '18 04:10 phucdat1d

Hello @phucdat1d ,

Do you think you could provide a project sample with this issue?

It will help my developer investigate the issue more efficiently.

We now always ask for a project sample even if the issue is easy to reproduce. As a free product, we must find some way to save time to offer an overall better experience for everyone and release fixes faster.

You can send it to: [email protected] if you need to keep the source private

Best Regards,

Jonathan


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

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

JonathanMagnan avatar Oct 26 '18 04:10 JonathanMagnan