Beispiel #1
0
 private async Task <int> ExecuteNonQueryAsync <T>(Object objQuery, List <ParameterQuery> parametersList)
 {
     try
     {
         using (connection = BuilderConnection.CreateDbConnection(provider, connectionString))
         {
             CommandDefinition commandDefinition = new CommandDefinition(commandText, CreateParameters(parametersList), null, 0, commandType);
             return(await connection.ExecuteAsync(commandDefinition));
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Beispiel #2
0
 public async Task <IEnumerable <T> > FetchWhereAsync <T>(Object objQuery, List <ParameterQuery> parametersList, string methodName)
 {
     try
     {
         GetConfiguration(objQuery, methodName);
         using (connection = BuilderConnection.CreateDbConnection(provider, connectionString))
         {
             CommandDefinition commandDefinition = new CommandDefinition(commandText, CreateParameters(parametersList), null, 0, commandType);
             return(await connection.QueryAsync <T>(commandDefinition));
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Beispiel #3
0
 public async Task <T> FetchSingle <T>(Object objQuery, List <ParameterQuery> parametersList, string methodName)
 {
     try
     {
         GetConfiguration(objQuery, methodName);
         using (connection = BuilderConnection.CreateDbConnection(provider, connectionString))
         {
             CommandDefinition commandDefinition = new CommandDefinition(commandText, CreateParameters(parametersList), null, 0, commandType);
             return(await connection.QuerySingleAsync <T>(commandDefinition));
         }
     }
     catch (Exception ex)
     {
         if (ex.Message.Contains("Sequence contains no elements"))
         {
             return(default(T));
         }
         throw ex;
     }
 }