User-2062540416 posted
public static IEnumerable<PortalList> GetAll()
{
Database db = DatabaseFactory.CreateDatabase();
DbCommand objComm = db.GetStoredProcCommand("package
name.procedurename", new object[1]);
var result = new List<PortalList>();
using (IDataReader rdr = db.ExecuteReader(objComm))
{
while (rdr.Read())
{
result.Add(Construct(rdr));
}
}
return result;
}
and my store procedure is like this
PROCEDURE PRC_PROCEDURE (resultset_out OUT TYPES.cursorType)
AS
BEGIN
OPEN resultset_out FOR SELECT * FROM PORTALLISTS;
END PRC_PORTALLISTS_GETALL;
i am having error in this line DbCommand
objComm = db.GetStoredProcCommand("package name.procedurename", new object[1]);
if i do this
DbCommand objComm = db.GetStoredProcCommand("package name.procedurename");
error is gone but then i am facing same error[Exception
thrown: 'System.AccessViolationException' in Microsoft.Practices.EnterpriseLibrary.Data.dll]
in this line using (IDataReader
rdr = db.ExecuteReader(objComm))
. i am using dot.net framework 4 and Microsoft.Practices.EnterpriseLibrary.Data.dll version is 5.0.0.0. can you guys pls help me?
and in portallistservices.cs file i have this
public static IEnumerable<PortalList> GetAll()
{
return GetAll(true);
}
private static IEnumerable<PortalList> GetAll(bool forceDataReload)
{
const string cacheKey = "PortalListService_GetAll";
IEnumerable<PortalList> result = null;
if (!forceDataReload)
result = GetFromCache(cacheKey);
if (result == null)
{
result = PortalListRepository.GetAll();
AddToCache(cacheKey, result);
}
return result;
}