Commit 9bd97984 authored by joncloud's avatar joncloud

Provided a name for MySql LAST_INSERT_ID call to allow the result to map correclty.

parent 29207803
......@@ -734,7 +734,7 @@ public int Insert(IDbConnection connection, IDbTransaction transaction, int? com
{
var cmd = String.Format("insert into {0} ({1}) values ({2})", tableName, columnList, parameterList);
connection.Execute(cmd, entityToInsert, transaction, commandTimeout);
var r = connection.Query("Select LAST_INSERT_ID()", transaction: transaction, commandTimeout: commandTimeout);
var r = connection.Query("Select LAST_INSERT_ID() id", transaction: transaction, commandTimeout: commandTimeout);
var id = r.First().id;
if (id == null) return 0;
......@@ -744,7 +744,7 @@ public int Insert(IDbConnection connection, IDbTransaction transaction, int? com
var idp = propertyInfos.First();
idp.SetValue(entityToInsert, Convert.ChangeType(id, idp.PropertyType), null);
return id;
return (int)id;
}
public void AppendColumnName(StringBuilder sb, string columnName)
......
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