Bath update can't support mysql
In efcore, I use Z.EntityFramework.Plus.EFCore.dll in myproject, When I use “Db.Set<Student>().Where(st=>st.Id==1).Update(student=>new Student() { Name= tempName});” it give me a error;description:MySqlException: Duplicate column name 'Id'; I keep watch on Mysql,it produce sql :
UPDATE `Student` AS A
INNER JOIN ( SELECT st.Id, st.Address, st.Age, st.BirthDay, st.CourceIds, st.CourceList, st.IsDeleted, st.Name, st.Phone, st.Id, st.Family_FatherName, st.Family_MotherName
FROM Student AS st
WHERE st.Id = 1
) AS B ON A.Id = B.Id
SET A.Name = 'rober20180912172602'
Hello @lechengbo ,
Please let me know about:
- Entity Framework Core version
- MySQL database provider & version
Best Regards,
Jonathan
Hello @lechengbo ,
Please let me know about:
- Entity Framework Core version
- MySQL database provider & version
Best Regards,
Jonathan
Entity Framework Core version:2.1 MySQL database version:5.7.22-log MySQL database provider:Pomelo.EntityFrameworkCore.MySql 2.1.2
Hello @lechengbo ,
My developer made some test but he never successfully reproduce the issue.
Do you think you could provide a sample project example/test with this issue?
It will help my developer investigate the issue more efficiently.
Best Regards.
Jonathan
Hello @JonathanMagnan ,
Please see the attachment


Hello @lechengbo ,
We will need a projects sample with the issue.
We already tried to reproduce it with similar configurations and we didn't have the error. So if you wish we continue to investigate and fix the issue, you will need to create a project and provide us an example that throws the error.
Best Regards,
Jonathan
Hello @JonathanMagnan , I found the problem;Please see the project and attachment; but I can't upload the project files,you should fix the issue
hello @JonathanMagnan when the class have another class,the error will throw
Hello @lechengbo ,
I'm not sure why you cannot upload the file, maybe a GitHub restriction on something in your files. Could you upload it somewhere else such as OneDrive and provide us the link?
Hello @JonathanMagnan Please see the link https://www.roberg.cn/otherfiles/bathupdatefail.rar https://www.roberg.cn/otherfiles/6.png
Hello @lechengbo ,
The current link doesn't look to work. We get a 404 error when trying to download your project.
Hello @JonathanMagnan Sorry, Please the link ,it can work. https://www.roberg.cn/OtherFiles/BatchUpdateFail.rar

Thank you @lechengbo ,
The task has been assigned to one of my developers.
Hello,
Just to let you know that we are not sure currently what to do. The issue might not be on our side but on Pomelo
For example,
This LINQ var test = db.Student.Where(x => x.Name.Contains("rober") ).ToList();
Provide the following SQL
SELECT `x`.`Id` , `x`.`Address` , `x`.`Age` , `x`.`BirthDay` ,
`x`.`CreatedTime`, `x`.`IsDeleted`, `x`.`Name`, `x`.`Phone`,
`x`.`Id`, `x`.`Family_FatherName`, `x`.`Family_MotherName`
FROM `Student` AS `x` WHERE LOCATE( 'rober' , `x`.`Name`) > 0
As you will notice, the Id is here twice and our library has not been used at all.
We are supposed to fully review the Batch Update and Batch Delete next month, perhaps we will find something to handle this.