Skip to content
New issue

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

[建议]不用Repository 实现添加或更新 #316

Closed
liaozb opened this issue May 20, 2020 · 3 comments
Closed

[建议]不用Repository 实现添加或更新 #316

liaozb opened this issue May 20, 2020 · 3 comments

Comments

@liaozb
Copy link

liaozb commented May 20, 2020

No description provided.

@2881099
Copy link
Collaborator

2881099 commented May 20, 2020

IFreeSql 定义了 InsertOrUpdate 方法实现添加或修改的功能,利用数据库特性:

Database Features
MySql on duplicate key update
PostgreSQL on conflict do update
SqlServer merge into
Oracle merge into
Sqlite replace into
Dameng merge into
fsql.InsertOrUpdate<T>()
  .SetSource(items) //需要操作的数据
  .ExecuteAffrows();

注意:FreeSql.Repository 通用仓储也有 InsertOrUpdate 方法,它们的机制不一样。

2881099 pushed a commit that referenced this issue May 20, 2020
@SugaraguS
Copy link

这个方法1.5.0上新加的吧?我看1.4.0上还木有

@2881099
Copy link
Collaborator

2881099 commented May 21, 2020

这个方法1.5.0上新加的吧?我看1.4.0上还木有

是的,1.5 的功能,现在可以下载 1.5.0-preview0521

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants