public static List <T> DataSource(string query) { var connection = new CommonConnection(); try { DataTable dataTable = connection.GetDataTable(query); var objData = (List <T>)ListConversion.ConvertTo <T>(dataTable); return(objData); } catch (Exception ex) { throw ex; } finally { connection.Close(); } }
public static List <T> GenericDataSource(string query) { var connection = new CommonConnection(); try { DataTable dataTable = connection.GetDataTable(query); var objData = (List <T>)GenericListGenerator.GetList <T>(dataTable); if (objData.Count == 0) { return(new List <T>()); } return(objData); } catch (Exception ex) { throw ex; } finally { connection.Close(); } }