var sql = @"INSERT INTO [MyTable] ([Stuff]) VALUES (@Stuff);";
sql += "SELECT CAST(SCOPE_IDENTITY() as int)";
var mytable = new MyTable();
mytable.Stuff = "test";
var id = connection.Query<int>(sql, mytable).FirstOrDefault();
var sql = @"INSERT INTO [MyTable] ([Stuff]) VALUES (@Stuff);";
sql += "SELECT CAST(SCOPE_IDENTITY() as int)";
var mytable = new MyTable();
mytable.Stuff = "test";
var id = connection.Query<int>(sql, mytable).FirstOrDefault();