public List <T> FindMany(IStatementSource source) { try { var sqlCommand = new SqlCommand(source.Query, DBConnection); sqlCommand.Parameters.AddRange(source.Parameters.ToArray()); var reader = sqlCommand.ExecuteReader(); var result = LoadAll(reader); reader.Close(); return(result); } catch (SqlException e) { throw new ApplicationException(e.Message, e); } }
public List <EntityBase> FindMany(IStatementSource source) { try { SessionFactory.GetCurrentSession().DbInfo.Connection.Open(); var sqlCommand = new SqlCommand(source.Query, DBConnection); sqlCommand.Parameters.AddRange(source.Parameters.ToArray()); var reader = sqlCommand.ExecuteReader(); var result = LoadAll(reader); reader.Close(); return(result); } catch (SqlException e) { throw new ApplicationException(e.Message, e); } finally { SessionFactory.GetCurrentSession().DbInfo.Connection.Close(); } }
public StockSource(IStockMapper mapper, IRawDataSource <StockRawData> stockRawDataSource, IStatementSource statementSource) { this.mapper = mapper; this.statementSource = statementSource; this.stockRawDataSource = stockRawDataSource; }