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

DbSessionExtensions DyUpdate是否可以考虑支持ExpandoObject或HashTable? #102

Closed
bryanli2018 opened this issue Aug 29, 2019 · 4 comments
Assignees

Comments

@bryanli2018
Copy link

bryanli2018 commented Aug 29, 2019

场景是这样,从前台传过来的json使用JsonConvert.DeserializeObject转换后,调用DyUpdate出错。
var str = "{ "UserID": "00000000-0000-0000-0000-000000000000","UserName": "管理员","UserCode":"admin","UserAccount":"admin"}";
object model = JsonConvert.DeserializeObject(str);
sqlMapper.SessionStore.Open().DyUpdate(model);

@Ahoo-Wang
Copy link
Member

目前是支持字典类型的。

@bryanli2018
Copy link
Author

请问有使用示例吗?为什么我传入Dictionary型参数会报Exception如下 :

◢ | $exception | {"Common Language Runtime detected an invalid program."} | System.InvalidProgramException
  | ▶ Data | {System.Collections.ListDictionaryInternal} | System.Collections.IDictionary {System.Collections.ListDictionaryInternal}
  | HResult | -2146233030 | int
  | HelpLink | null | string
  | ▶ InnerException | null | System.Exception
  | Message | "Common Language Runtime detected an invalid program." | string
  | Source | "System.Private.CoreLib" | string
  | StackTrace | " at SmartSql.Reflection.RequestConvert.ToSqlParameters(Object sourceObj, Boolean ignoreNameCase) in E:\Study\SmartSql-master\src\SmartSql\Reflection\RequestConvert.cs:line 18\r\n at SmartSql.DbSessionExtensions.DyUpdate[TEntity](IDbSession dbSession, Object entity) in E:\Study\SmartSql-master\src\SmartSql\CUD\DbSessionExtensions.cs:line 179\r\n at SmartSql.ISqlMapperExtensions.DyUpdate[TEntity](ISqlMapper sqlMapper, Object entity) in E:\Study\SmartSql-master\src\SmartSql\CUD\ISqlMapperExtensions.cs:line 23\r\n at MyTest.Program.DyUpdate() in E:\Study\SmartSql-master\MyTest\Program.cs:line 143\r\n at MyTest.Program.Main(String[] args) in E:\Study\SmartSql-master\MyTest\Program.cs:line 26" | string
  | ▶ TargetSite | {SmartSql.Data.SqlParameterCollection ToSqlParameters(System.Object, Boolean)} | System.Reflection.MethodBase {System.Reflection.RuntimeMethodInfo}
  | ▶ Static members |   |  
  | ▶ Non-Public members |   |  

Ahoo-Wang added a commit that referenced this issue Aug 30, 2019
@Ahoo-Wang
Copy link
Member

更新一下版本。v4.1.26 刚刚发布。

@bryanli2018
Copy link
Author

可以了,谢谢!

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

2 participants