I'm using FluentMigrator with MySql and C#.
[Migration(3)]
public class _0003_TestMigrationTI : Migration
{
public override void Up()
{
Insert.IntoTable("cmn_file_types").Row(new { Name = "Image", Code = "IMG" });
???
}
}
How to get last inserted id after Insert.IntoTable in the same Up() method? The ID is an INT PRIMARY AUTO_INCREMENT column in cmn_file_types table.
MigrationBase class has ConnectionsString property. Just use it creating your ADO.net query:
update:
Try this one. Worked for me. Here you'll get the same transaction for your new query, unlike that case with ADO. So "select IDENT_CURRENT" will show you uncommited current Id.