/// <summary> /// Execute reader and create list of provided type using IRowMapper interface. /// </summary> /// <typeparam name="T">Type of object to create.</typeparam> /// <param name="query">Sql Query.</param> /// <param name="args">Sql Parameters.</param> /// <param name="extractor">IDataExtractor used to map object instance from reader.</param> /// <param name="isStoredProcedure">indicating if query type is stored procedure.</param> /// <returns>List of provided object type.</returns> public IEnumerable <T> Select <T>(string query, IEnumerable <QueryParameter> args, IDataExtractor <T> extractor) { using (SqlConnection Connection = new SqlConnection(ConnectionString)) { Connection.Open(); using (SqlCommand command = Connection.CreateCommand()) { command.CommandText = query; PrepareCommandParameters(command, args); IEnumerable <T> result; using (SqlDataReader reader = command.ExecuteReader()) { result = extractor.Extract(reader); reader.Close(); } return(result); } } }
public TRawData Get(string param = "") { string html = htmlSource.GetHtml(param); var rawData = extractor.Extract(html); return(rawData); }
/// <summary> /// Execute reader and create list of provided type using IDataExtractor interface. /// </summary> /// <typeparam name="T">Type of object to create.</typeparam> /// <typeparam name="P">Extractor arguments type.</typeparam> /// <param name="query">Sql Query.</param> /// <param name="args">Sql Parameters.</param> /// <param name="extractor">IDataExtractor used to map object instance from reader.</param> /// <param name="extractorArgs">Arguments to pass to extract method.</param> /// <returns>List of provided object type.</returns> public IEnumerable <T> Select <T, P>(string query, IEnumerable <QueryParameter> args, IDataExtractor <T, P> extractor, P extractorArgs) { return(SelectWith(query, args, (reader) => { return extractor.Extract(reader, extractorArgs); })); }
public virtual List <T> Process(IEnumerable <string> rows) { var processedItems = new List <T>(); object sync = new object(); Parallel.ForEach ( rows, () => new List <T>(), (row, state, localProcessedItems) => { if (!string.IsNullOrEmpty(row) && row[0] != '#') { localProcessedItems.Add(dataExtractor.Extract(row)); } return(localProcessedItems); }, (finalResult) => { lock (sync) processedItems.AddRange(finalResult); } ); return(processedItems); }
/// <summary> /// Process single ETL operation /// </summary> /// <returns>Information regarding ETC process</returns> public OperationResult Process() { var extracted = _extractor.Extract(); var cleansed = _cleanser.Cleanse(extracted); var transformed = _transformer.Transform(cleansed); return(_loader.Load(transformed)); }
private IEnumerable <T> SelectInternal <T, P>(string query, IEnumerable <SQLiteQueryParameter> args, IDataExtractor <T, P> extractor, P extractorArgs, SQLiteConnection connection) { using (SQLiteCommand command = connection.CreateCommand()) { command.CommandText = query; PrepareCommandParameters(command, args); IEnumerable <T> result; using (SQLiteDataReader reader = command.ExecuteReader()) { result = extractor.Extract(reader, extractorArgs); reader.Close(); } return(result); } }
/// <summary> /// This is the method background worker will be calling to process the job /// </summary> /// <param name="scanJob">Scan job as input</param> /// <returns>task</returns> async Task Process(ScanJob scanJob) { await _dataExtractor.Extract(scanJob); }
public void Test_CheckIfArgumentNullExceptionOccurWhenStringDataIsEmpty() { //Act materialDataExtractor.Extract(""); }
public ExpenseClaimResult Process(string email) { var expenseClaimInput = _emailDataExtractor.Extract(email); return(BuildExpenseClaimResult(expenseClaimInput)); }
internal DocumentRequest ExtractDataFromXml(DocumentRequest request) { return(_dataExtractor.Extract(request)); }