/// <summary> /// Execute the query and return a list or array of new instances of typed results filled with data table results. /// </summary> /// <typeparam name="T">Object type for first table</typeparam> /// <typeparam name="U">Object type for second table</typeparam> /// <returns>List of array of typed results</returns> /// <example> /// <code> /// var data = cmd.ExecuteDataSet<Employee, Department>(); /// var employees = data.Item1; /// var departments = data.Item2; /// </code> /// </example> public virtual Tuple <IEnumerable <T>, IEnumerable <U> > ExecuteDataSet <T, U>(T typeOfItem1, U typeOfItem2) { var datasets = ExecuteInternalCommand(() => { using (DbDataReader dr = this.Command.ExecuteReader()) { return(DataReaderConvertor.ToMultipleTypes <T, U, NoType, NoType, NoType>(dr, forAnonymousTypes: true)); } }); return(new Tuple <IEnumerable <T>, IEnumerable <U> > ( datasets.Item1, datasets.Item2 )); }
/// <summary> /// Execute the query and return a list or array of new instances of typed results filled with data table results. /// </summary> /// <typeparam name="T">Object type for first table</typeparam> /// <typeparam name="U">Object type for second table</typeparam> /// <typeparam name="V">Object type for third table</typeparam> /// <returns>List of array of typed results</returns> /// <example> /// <code> /// var data = cmd.ExecuteDataSet<Employee, Department>(); /// var employees = data.Item1; /// var departments = data.Item2; /// </code> /// </example> public virtual Tuple <IEnumerable <T>, IEnumerable <U>, IEnumerable <V> > ExecuteDataSet <T, U, V>() { var datasets = ExecuteInternalCommand(() => { using (DbDataReader dr = this.Command.ExecuteReader()) { return(DataReaderConvertor.ToMultipleTypes <T, U, V, NoType, NoType>(dr)); } }); return(new Tuple <IEnumerable <T>, IEnumerable <U>, IEnumerable <V> > ( datasets.Item1, datasets.Item2, datasets.Item3 )); }