Otis wrote:
You can accomplish the same thing in selfservicing, by passing a Transaction object, and by adding the entity/entities to be saved to that transaction prior to saving them. That should do it. (Haven't tested this though).
Thanks, got it working - for those who are interested:
trx = new Transaction(IsolationLevel.ReadUncommitted, "MakeSomeItems");
// We need to be allowed to insert into IDENTITY field in Item
IDbCommand cmd = trx.ConnectionToUse.CreateCommand();
cmd.Transaction = trx.PhysicalTransaction;
cmd.CommandText = "set IDENTITY_INSERT [Kiosk].[dbo].[Item] on";
cmd.ExecuteNonQuery();
<!-- blah blah blah Make an Item or 500 -->
trx.Add(item);
item.Save();
// We've finished playing silly buggers with IDENTITY column in Item
cmd = trx.ConnectionToUse.CreateCommand();
cmd.Transaction = trx.PhysicalTransaction;
cmd.CommandText = "set IDENTITY_INSERT [Kiosk].[dbo].[Item] off";
cmd.ExecuteNonQuery();
//We're done
trx.Commit();