We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
InsertOrUpdate() .SetSource(data) .ExecuteAffrowsAsync(); 在执行时,似乎是以主键为主,主键存在时执行更新,不存在时,执行插入。当表中除了主键外,还有唯一索引时,唯一索引存在时,则不会执行更新,而是直接报错,报索引冲突。
SetSource的重载方法,指定临时主键仅对 SqlServer/PostgreSQL/Firebird/达梦/南大通用/金仓/神通 有效
而InsertOrUpdate() .SetSource(data).ExecuteMySqlBulkCopy() 则不存在此问题,唯一索引存在时,也会执行更新,不存在时,也会执行插入。
InsertOrUpdate<T>() .SetSource(data) .ExecuteAffrowsAsync();
mysql 5.7
各版本都有此问题
net core6-net core8
The text was updated successfully, but these errors were encountered:
mysql原生sql指定字段插入或更新
Sorry, something went wrong.
嗯,目前是这样处理的。
No branches or pull requests
问题描述及重现代码:
InsertOrUpdate()
.SetSource(data)
.ExecuteAffrowsAsync();
在执行时,似乎是以主键为主,主键存在时执行更新,不存在时,执行插入。当表中除了主键外,还有唯一索引时,唯一索引存在时,则不会执行更新,而是直接报错,报索引冲突。
SetSource的重载方法,指定临时主键仅对 SqlServer/PostgreSQL/Firebird/达梦/南大通用/金仓/神通 有效
而InsertOrUpdate()
.SetSource(data).ExecuteMySqlBulkCopy()
则不存在此问题,唯一索引存在时,也会执行更新,不存在时,也会执行插入。
数据库版本
mysql 5.7
安装的Nuget包
各版本都有此问题
.net framework/. net core? 及具体版本
net core6-net core8
The text was updated successfully, but these errors were encountered: