Commit ad5afe13 authored by Marc Gravell's avatar Marc Gravell

fix comment to avoid anyone doing anything silly with IDENT_CURRENT

parent 8ab859c7
......@@ -527,7 +527,7 @@ public int Insert(IDbConnection connection, IDbTransaction transaction, int? com
connection.Execute(cmd, entityToInsert, transaction: transaction, commandTimeout: commandTimeout);
//NOTE: would prefer to use IDENT_CURRENT('tablename') or IDENT_SCOPE but these are not available on SQLCE
//NOTE: would prefer to use SCOPE_IDENTITY but this are not available on SQLCE
var r = connection.Query("select @@IDENTITY id", transaction: transaction, commandTimeout: commandTimeout);
int id = (int)r.First().id;
if (keyProperties.Any())
......
......@@ -3198,6 +3198,25 @@ public void DataTableParameters()
ex.Message.Equals("The table type parameter 'ids' must have a valid type name.");
}
}
public void SO29533765_DataTableParametersViaDynamicParameters()
{
try { connection.Execute("drop proc #DataTableParameters"); } catch { }
try { connection.Execute("drop table #DataTableParameters"); } catch { }
try { connection.Execute("drop type MyTVPType"); } catch { }
connection.Execute("create type MyTVPType as table (id int)");
connection.Execute("create proc #DataTableParameters @ids MyTVPType readonly as select count(1) from @ids");
var table = new DataTable { TableName="MyTVPType", Columns = { { "id", typeof(int) } }, Rows = { { 1 }, { 2 }, { 3 } } };
table.SetTypeName(table.TableName); // per SO29533765
IDictionary<string, object> args = new Dictionary<string, object>();
args.Add("ids", table);
int count = connection.Query<int>("#DataTableParameters", args, commandType: CommandType.StoredProcedure).First();
count.IsEqualTo(3);
count = connection.Query<int>("select count(1) from @ids", args).First();
count.IsEqualTo(3);
}
public void SO26468710_InWithTVPs()
{
// this is just to make it re-runnable; normally you only do this once
......
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