添加InsertOrUpdateDict的Dynamic类型扩展方法#1784
Open
hjkl950217 wants to merge 1 commit intodotnetcore:masterfrom
Open
Conversation
Collaborator
|
感谢贡献,不过由于 dynamic 依赖 Microsoft.xxx.Script 版本会导致依赖冲突 因此默认没有集成这个类型,FreeSql 宗旨是零依赖。 |
Contributor
Author
|
是.net框架上的Script版本吗? 我这里是.net6 只引用了 |
Collaborator
|
.net framework,还有 xamarin,这个之前已经遇到过,.net6高版本没有这个问题。 |
Contributor
Author
|
要不加一个条件编译? net6以上才有这个扩展 |
hyzx86
suggested changes
Jun 23, 2024
| insertOrUpdateDict._insertOrUpdateProvider.SetSource(source); | ||
| return insertOrUpdateDict; | ||
| } | ||
| public static InsertOrUpdateDictImpl InsertOrUpdateDict(this IFreeSql freesql, IEnumerable<dynamic> source) |
Contributor
There was a problem hiding this comment.
不要使用 dynamic ,如果你是用的基类型是 ExpandoObject 那么可以 使用它的基类 IDictionary<string,Object>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
近期有一个需求,需要从mysql迁移数据到DM, 而且还能能使用多次,还好
InsertOrUpdateDict方法解决了我的问题。Dictionary<string, object>和Dynamic理论上能相互转换,我项目里用的多的是Dynamic,背后是ExpandoObject.顺手就把需要的这个方法扩展出来了