Commit f39cff33 authored by GermanTikhonov23's avatar GermanTikhonov23 Committed by Nick Craver

Fix for InsertAsync in PostgresAdapter (#689)

* Fix for PostgresAdapter in SqlMapperExtensions.Async. Copied same line of code from SqlMapperExtensions to fix RuntimeBinderException on InsertAsync
* Cleanup
parent bc9644a7
...@@ -458,10 +458,9 @@ public async Task<int> InsertAsync(IDbConnection connection, IDbTransaction tran ...@@ -458,10 +458,9 @@ public async Task<int> InsertAsync(IDbConnection connection, IDbTransaction tran
// Return the key by assinging the corresponding property in the object - by product is that it supports compound primary keys // Return the key by assinging the corresponding property in the object - by product is that it supports compound primary keys
var id = 0; var id = 0;
var values = results.First();
foreach (var p in propertyInfos) foreach (var p in propertyInfos)
{ {
var value = values[p.Name.ToLower()]; var value = ((IDictionary<string, object>)results.First())[p.Name.ToLower()];
p.SetValue(entityToInsert, value, null); p.SetValue(entityToInsert, value, null);
if (id == 0) if (id == 0)
id = Convert.ToInt32(value); id = Convert.ToInt32(value);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment