public override int Insert(User o) { using (var scope = new TransactionScope()) { var userId = DbUtil.Insert(o, Cs, new[] { "Id", "Roles" }); foreach (var role in o.Roles) { DbUtil.ExecuteNonQuerySp("assignRole", new { userId, roleId = role.Id }, Cs); } scope.Complete(); return(userId); } }
//returns the new autogenerated id public virtual int Insert(T o) { return(DbUtil.Insert(o, Cs)); }
public int Insert(object o) { return(DbUtil.Insert(o, Cs)); }