// --------------------------------------------------------------------- // Insert // --------------------------------------------------------------------- public void Insert <T>(T model, String statement, IInsertable <T> traits) { using (SqlCommand cmd = new SqlCommand(statement, m_connection)) { traits.ApplyInsert(model, cmd); cmd.ExecuteNonQuery(); } }
// --------------------------------------------------------------------- // Insert // --------------------------------------------------------------------- public void Insert <T>(T model, String statement, IInsertable <T> traits) { using (IDbCommand command = m_connection.CreateCommand()) { command.CommandText = statement; traits.ApplyInsert(model, command); command.ExecuteNonQuery(); } IAutoNumberable <T> anTraits = traits is IAutoNumberable <T> ?traits as IAutoNumberable <T> : Orm.GetAutoNumberable <T>() ; if (anTraits != null) { anTraits.ApplyAutoNumber(model, GetLastInsertRowId()); } }