예제 #1
0
 public IHiLoRange Execute(string key)
 {
     using (SqlConnection conn = sql_connection_provider_.CreateConnection())
         using (var builder = new CommandBuilder(conn)) {
             IDbCommand cmd = builder
                              .SetText(sql_connection_provider_.Schema + kExecute)
                              .SetType(CommandType.StoredProcedure)
                              .AddParameter(kKeyParameter, key)
                              .Build();
             try {
                 conn.Open();
                 using (IDataReader reader = cmd.ExecuteReader()) {
                     return(mapper_.Map(reader));
                 }
             } catch (SqlException e) {
                 logger_.Error(string.Format(
                                   StringResources.Log_MethodThrowsException, "Execute", kClassName), e);
                 throw new ProviderException(e);
             }
         }
 }
예제 #2
0
 /// <summary>
 /// Maps a element of a query result to a object of type
 /// <typeparamref name="T"/>.
 /// </summary>
 /// <returns>
 /// A object of type <typeparamref name="T"/> containing the data readed
 /// from the current row of the associated <see cref="IDataReader"/>.
 /// </returns>
 public T Map()
 {
     return(mapper_.Map(reader_));
 }