I am using Telercik Open Access v2011.1.411.2 for database connection.
In my web service I have defined a DbContext object and I use it in all my transactions.
public class ExtremeService : IExtremeService
{
private static ExtremeModelDbContext m_DbContext = new ExtremeModelDbContext();
.
.
.
public List<Procedure> ReadAllProcedures()
{
return m_DbContext.Procedures.ToList();
}
.
.
.
}
when running transaction sometimes it gives an error such as
Error executing query: Telerik.OpenAccess.RT.sql.SQLException: There is already an open DataReader associated with this Connection which must be closed first.
at Telerik.OpenAccess.RT.Adonet2Generic.Impl.PreparedStatementImp.executeQuery()
at OpenAccessRuntime.Relational.conn.PooledPreparedStatement.executeQuery()
at OpenAccessRuntime.Relational.fetch.FetchResultImp.Execute()
SQL:
SELECT a.`ID` AS COL1, a.`CULTURE` AS COL2, a.`DESCRIPTION` AS COL3, a.`STATUS_CODE` AS COL4 FROM `ris_status_codes` a ORDER BY a.`ID` Telerik.OpenAccess.RT.sql.SQLException: There is already an open DataReader associated with this Connection which must be closed first.
at Telerik.OpenAccess.RT.Adonet2Generic.Impl.PreparedStatementImp.executeQuery()
at OpenAccessRuntime.Relational.conn.PooledPreparedStatement.executeQuery()
at OpenAccessRuntime.Relational.fetch.FetchResultImp.Execute()
Is using same DbContext object for every transaction causes this problem?
Do I have to create new DbContext object for every transaction?
How can I solve this problem?
Thanks,
Burhan Eyimaya