public async Task <ActionResult <object> > Save(int id, [FromBody] MOL mol) { dapper .UseBulkOptions(x => { x.ColumnPrimaryKeyNames = new List <string>() { "MOL_ID" }; x.DestinationTableName = "MOLS"; }) .BulkUpdate(mol); await Task.Delay(1000); return(Ok((await dapper.QueryAsync(@"select * from mols where mol_id = @id", new { id })).Single())); }
public async Task <ActionResult <object> > InsertAsync([FromBody] MOL mol) { mol.MOL_ID = (new System.Random()).Next(); dapper .UseBulkOptions(x => { x.ColumnPrimaryKeyNames = new List <string>() { "MOL_ID" }; x.DestinationTableName = "MOLS"; }) .BulkInsert(mol); await Task.Delay(4000); return(Ok((await dapper.QueryAsync(@"select * from mols where mol_id = @mol_id", new { mol.MOL_ID })).Single())); }