/// <summary> /// Returns all Folks in the database /// </summary> /// <returns></returns> public List <FolksModel> GetAllFolks() { try { //using the respository pattern which models my data access layer Business.SingleTable.Bo.List.Folks boList = new Business.SingleTable.Bo.List.Folks(SmoSettings[CONNECTION_STRING_NAME_LOCAL]); boList.FillByGetAll(new Business.SingleTable.Bo.Folks(SmoSettings[CONNECTION_STRING_NAME_LOCAL])); //this is a separation of the business model itself from the objects that are to be consumed from //the Controller in the MVC pattern or the WCF Service Layer return(ConvertBusinessObjectsToDataContracts(boList)); } catch (Exception ex) { //log the exception information in a log file but do not propogate to the client, send friendly message Application Exception to //bubble up the stack _log.Error("Exception in GetAllFolks Method in FolksBusinessManager", ex); throw new ApplicationException("Exception Occurred Cannot Load Famous Folks"); } }
private List <FolksModel> ConvertBusinessObjectsToDataContracts(Business.SingleTable.Bo.List.Folks boList) { return(boList.ConvertAll(new Converter <Folks, FolksModel>(ConvertBoToDataContract))); }