public int Insert(DataAspect aspect, IEnumerable <AspectMemberValue> values, out object identityValue) { using (IDbConnection conn = _dialect.CreateConnection(_ConnectionString)) { conn.Open(); try { bool hasIdentity; DatabaseCommand cmd = _dialect.CreateInsert(aspect, values, out hasIdentity); if (hasIdentity) { identityValue = cmd.ExecuteScalar(conn); return(1); } else { identityValue = null; return(cmd.ExecuteNonQuery(conn)); } } finally { conn.Close(); } } }