Ejemplo n.º 1
0
 public async static Task <DbOutput <T> > ExecuteStoredProcAsync <T>(this DbCommand command)
 {
     using (command)
     {
         if (command.Connection.State == System.Data.ConnectionState.Closed)
         {
             command.Connection.Open();
         }
         try
         {
             using (var reader = await command.ExecuteReaderAsync())
             {
                 DbOutput <T> output = new DbOutput <T>();
                 output.AddRange(reader.MapToList <T>());
                 output.DbParameters = command.Parameters;
                 return(output);
             }
         }
         finally
         {
             command.Connection.Close();
         }
     }
 }