예제 #1
0
 /// <summary>
 /// Executes command using System.Data.CommandType.StoredProcedure command type
 /// and returns results as collection of values of specified type
 /// </summary>
 /// <param name="storeProcedureName">Store procedure name</param>
 /// <param name="dataParameters">Command parameters</param>
 /// <returns>Collection of query result records</returns>
 public virtual IList <TEntity> EntityFromSql(string storeProcedureName, params DataParameter[] dataParameters)
 {
     using (var _dataConnection = new NopDataConnection())
     {
         return(_dataConnection.ExecuteStoredProcedure <TEntity>(storeProcedureName, dataParameters?.ToArray()));
     }
 }
예제 #2
0
 /// <summary>
 /// Executes command using System.Data.CommandType.StoredProcedure command type and
 /// returns results as collection of values of specified type
 /// </summary>
 /// <typeparam name="T">Result record type</typeparam>
 /// <param name="procedureName">Procedure name</param>
 /// <param name="parameters">Command parameters</param>
 /// <returns>Returns collection of query result records</returns>
 public virtual IList <T> QueryProc <T>(string procedureName, params DataParameter[] parameters)
 {
     using (var currentConnection = new NopDataConnection())
     {
         return(currentConnection.ExecuteStoredProcedure <T>(procedureName, parameters) ?? new List <T>());
     }
 }