示例#1
0
 private long ExecuteDMLQuery(T entity, ToSqlCommand commandDelegate)
 {
     using (SqlConnection connection = new SqlConnection(CONNECTION_STRING))
     {
         connection.Open();
         using (IDbCommand command = commandDelegate(entity, connection))
         {
             return(Convert.ToInt64(command.ExecuteScalar()));
         }
     }
 }
示例#2
0
 private long ExecuteDMLQuery(T entity, ToSqlCommand commandDelegate)
 {
     using (SqlConnection connection = new SqlConnection(CONNECTION_STRING))
     {
         connection.Open();
         using (IDbCommand command = commandDelegate(entity, connection))
         {
             object result = command.ExecuteScalar();
             return(result != null?Convert.ToInt64(result) : -1);
         }
     }
 }