How do I perform an insert to database and return inserted identity with Dapper?
I\'ve tried something like this:
string sql = \"DECLARE @ID int; \"
There is a great library to make your life easier Dapper.Contrib.Extensions. After including this you can just write:
public int Add(Transaction transaction) { using (IDbConnection db = Connection) { return (int)db.Insert(transaction); } }