@@ -103,91 +103,91 @@ public List<DataDictionary> FetchData(string selectSql, bool upperCaseKeys = fal
103103 }
104104
105105 /// <summary>
106- /// Asynchronously executes and retrieves records for 'Select' queries from the database.
107- /// Converts column names to keys holding values, with multiple database rows returned into a list.
108- /// Note: Use aliases in query for similar column names.
106+ /// Executes and retrieves records for 'Select' queries from the database.
109107 /// </summary>
108+ /// <typeparam name="T">Object entity to return data mapped into.</typeparam>
110109 /// <param name="selectSql">'Select' query.</param>
111- /// <param name="upperCaseKeys">Boolean parameter to return dictionary keys in uppercase . Default - <c>false</c>.</param>
112- /// <returns>List of <see cref="DataDictionary"/> with column names as keys holding values into a list for multiple rows of data .</returns>
113- public async Task < List < DataDictionary > > FetchDataAsync ( string selectSql , bool upperCaseKeys = false )
110+ /// <param name="strict">Enables fetch data only for object type <typeparamref name="T"/> properties existing in database query result . Default - <c>false</c>.</param>
111+ /// <returns>List of data rows mapped into object of type <typeparamref name="T"/> .</returns>
112+ public List < T > FetchData < T > ( string selectSql , bool strict = false ) where T : new ( )
114113 {
115- var dataList = new List < DataDictionary > ( ) ;
114+ var dataList = new List < T > ( ) ;
116115 if ( Database . Equals ( DB . MSSQL ) )
117116 {
118117 using ( var msSqlDBConnection = GetSqlServerConnection ( ) )
119118 {
120119 var _systemAdapter = new MSSQL . Adapter ( ) ;
121- dataList = await _systemAdapter . FetchDataAsync ( selectSql , msSqlDBConnection . SqlConnection , upperCaseKeys ) ;
120+ dataList = _systemAdapter . FetchData < T > ( selectSql , msSqlDBConnection . SqlConnection , strict ) ;
122121 }
123122 }
124123 else if ( Database . Equals ( DB . MySQL ) )
125124 {
126125 using ( var mySqlDBConnection = GetMySqlConnection ( ) )
127126 {
128127 var _systemAdapter = new MySQL . Adapter ( ) ;
129- dataList = await _systemAdapter . FetchDataAsync ( selectSql , mySqlDBConnection . MySqlConnection , upperCaseKeys ) ;
128+ dataList = _systemAdapter . FetchData < T > ( selectSql , mySqlDBConnection . MySqlConnection , strict ) ;
130129 }
131130 }
132131 else if ( Database . Equals ( DB . Oracle ) )
133132 {
134133 using ( var oracleDBConnection = GetOracleConnection ( ) )
135134 {
136135 var _systemAdapter = new Oracle . Adapter ( ) ;
137- dataList = await _systemAdapter . FetchDataAsync ( selectSql , oracleDBConnection . OracleConnection , upperCaseKeys ) ;
136+ dataList = _systemAdapter . FetchData < T > ( selectSql , oracleDBConnection . OracleConnection , strict ) ;
138137 }
139138 }
140139 else if ( Database . Equals ( DB . PostgreSQL ) )
141140 {
142141 using ( var postgreSqlDBConnection = GetPostgreSqlConnection ( ) )
143142 {
144143 var _systemAdapter = new PostgreSQL . Adapter ( ) ;
145- dataList = await _systemAdapter . FetchDataAsync ( selectSql , postgreSqlDBConnection . PostgreSQLConnection , upperCaseKeys ) ;
144+ dataList = _systemAdapter . FetchData < T > ( selectSql , postgreSqlDBConnection . PostgreSQLConnection , strict ) ;
146145 }
147146 }
148147 return dataList ;
149148 }
150149
151150 /// <summary>
152- /// Executes and retrieves records for 'Select' queries from the database.
151+ /// Asynchronously executes and retrieves records for 'Select' queries from the database.
152+ /// Converts column names to keys holding values, with multiple database rows returned into a list.
153+ /// Note: Use aliases in query for similar column names.
153154 /// </summary>
154- /// <typeparam name="T">Object entity to return data mapped into.</typeparam>
155155 /// <param name="selectSql">'Select' query.</param>
156- /// <param name="strict">Enables fetch data only for object type <typeparamref name="T"/> properties existing in database query result . Default - <c>false</c>.</param>
157- /// <returns>List of data rows mapped into object of type <typeparamref name="T"/> .</returns>
158- public List < T > FetchData < T > ( string selectSql , bool strict = false ) where T : new ( )
156+ /// <param name="upperCaseKeys">Boolean parameter to return dictionary keys in uppercase . Default - <c>false</c>.</param>
157+ /// <returns>List of <see cref="DataDictionary"/> with column names as keys holding values into a list for multiple rows of data .</returns>
158+ public async Task < List < DataDictionary > > FetchDataAsync ( string selectSql , bool upperCaseKeys = false )
159159 {
160- var dataList = new List < T > ( ) ;
160+ var dataList = new List < DataDictionary > ( ) ;
161161 if ( Database . Equals ( DB . MSSQL ) )
162162 {
163163 using ( var msSqlDBConnection = GetSqlServerConnection ( ) )
164164 {
165165 var _systemAdapter = new MSSQL . Adapter ( ) ;
166- dataList = _systemAdapter . FetchData < T > ( selectSql , msSqlDBConnection . SqlConnection , strict ) ;
166+ dataList = await _systemAdapter . FetchDataAsync ( selectSql , msSqlDBConnection . SqlConnection , upperCaseKeys ) ;
167167 }
168168 }
169169 else if ( Database . Equals ( DB . MySQL ) )
170170 {
171171 using ( var mySqlDBConnection = GetMySqlConnection ( ) )
172172 {
173173 var _systemAdapter = new MySQL . Adapter ( ) ;
174- dataList = _systemAdapter . FetchData < T > ( selectSql , mySqlDBConnection . MySqlConnection , strict ) ;
174+ dataList = await _systemAdapter . FetchDataAsync ( selectSql , mySqlDBConnection . MySqlConnection , upperCaseKeys ) ;
175175 }
176176 }
177177 else if ( Database . Equals ( DB . Oracle ) )
178178 {
179179 using ( var oracleDBConnection = GetOracleConnection ( ) )
180180 {
181181 var _systemAdapter = new Oracle . Adapter ( ) ;
182- dataList = _systemAdapter . FetchData < T > ( selectSql , oracleDBConnection . OracleConnection , strict ) ;
182+ dataList = await _systemAdapter . FetchDataAsync ( selectSql , oracleDBConnection . OracleConnection , upperCaseKeys ) ;
183183 }
184184 }
185185 else if ( Database . Equals ( DB . PostgreSQL ) )
186186 {
187187 using ( var postgreSqlDBConnection = GetPostgreSqlConnection ( ) )
188188 {
189189 var _systemAdapter = new PostgreSQL . Adapter ( ) ;
190- dataList = _systemAdapter . FetchData < T > ( selectSql , postgreSqlDBConnection . PostgreSQLConnection , strict ) ;
190+ dataList = await _systemAdapter . FetchDataAsync ( selectSql , postgreSqlDBConnection . PostgreSQLConnection , upperCaseKeys ) ;
191191 }
192192 }
193193 return dataList ;
0 commit comments