protected List <TEntity> LoadList(TLoadParam id, PrepareCommandForLoadDelegate prepareCommandMethod, ExecuteReaderDelegate executeReaderMethod, ReadCommandParametersDelegate readCommandParametersMethod) { List <TEntity> entityList = new List <TEntity>(); TEntity entity = default(TEntity); try { DbCommand command = prepareCommandMethod(database, id); var reader = database.ExecuteReader(command); while (reader.Read()) { entity = executeReaderMethod(reader, entity); entityList.Add(entity); } if (readCommandParametersMethod != null) { entity = readCommandParametersMethod(database, command, entity); } } catch (Exception ex) { // Logger.Error(ex != null ? ex.ToString() : "Unknown Error in Repository.LoadList()"); return(entityList); } return(entityList); }
protected TLoadParam LoadParentChild(TLoadParam entity, PrepareCommandForLoadDelegate prepareCommandMethod, ExecuteDataSetDelegate executeDataSetMethod, ReadCommandParametersDelegate readCommandParametersMethod) { try { DbCommand command = prepareCommandMethod(database, entity); var reader = database.ExecuteDataSet(command); entity = executeDataSetMethod(reader, entity); } catch (Exception ex) { // Logger.Error(ex != null ? ex.ToString() : "Unknown Error in Repository.LoadParentChild()"); return(default(TLoadParam)); } return(entity); }
protected List <TEntity> LoadList(TLoadParam id, PrepareCommandForLoadDelegate prepareCommandMethod, ExecuteReaderDelegate executeReaderMethod) { return(LoadList(id, prepareCommandMethod, executeReaderMethod, null)); }