Uploaded image for project: 'iBatis for .NET'
  1. iBatis for .NET
  2. IBATISNET-144

IDao implementation with ref parameter causes System.ExecutionEngineException.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • DataAccess 1.7
    • None
    • DataAccess
    • None

    Description

      Implementing IDao and defining Dao method with "ref" parameter
      and loading through DaoManager causes
      "An unhandled exception of type 'System.ExecutionEngineException' occurred in mscorlib.dll".
      This problem only happens if I load my Dao through
      DaoManager(of DataAccess Framework) with "ref" parameter and not happens
      if I load my Dao directly through SqlMapper(of DataMapper Framework)
      with "ref" parameter.
      This might be the DynamicProxy issue.

      The following snippet describes the differences between the above.
      /*************************************************************************************/
      private DaoManager daoManager;
      private IDailyDao dailyDao = null;
      internal DailyService()

      { //DataAccessConfigurator configures and loads DaoManager daoManager = DataAccessConfigurator.GetDaoManager(); }

      public bool LoadThroughDaoManager(ref object dailyDB, string sOfficeCode)
      {
      //This load DailyDao instance through dao.config
      dailyDao = daoManager[typeof(IDailyDao)] as IDailyDao;

      try
      {
      //Begin trans
      using (IDalSession session = this.daoManager.OpenConnection())

      { dailyDao.SelectDaily(sOfficeCode, ref dailyDB); }
      return true;
      }
      catch (Exception ex)
      {
      throw new RdbAccessException(string.Format(@"Failed to load Daily throught DailyService.
      OfficeCode={0} DailyNo={1}",sOfficeCode,((DailyDB)dailyDB).sNo), ex);
      }
      }

      public bool LoadThroughSqlMapper(ref object dailyDB, string sOfficeCode)
      {
      IBatisNet.DataMapper.SqlMapper mapper = IBatisNet.DataMapper.Mapper.Instance();

      //Directly instantiate DailyDao
      dailyDao = new DailyDao();
      ((DailyDao)dailyDao).SetContext(mapper);

      try
      {
      //Begin trans
      using (IDalSession session = mapper.OpenConnection())
      { dailyDao.SelectDaily(sOfficeCode, ref dailyDB); }

      return true;
      }
      catch (Exception ex)
      {
      throw new RdbAccessException(string.Format(@"Failed to load Daily throught DailyService.
      OfficeCode=

      {0}

      DailyNo=

      {1}

      ",sOfficeCode,((DailyDB)dailyDB).sNo), ex);
      }
      }
      /*************************************************************************************/

      The same exception occurs in the environment of the recent SVN version.
      Any response is appreciated.

      [Note]
      Using NAnt with iBATIS.build file of the recent SVN causes compile error
      unless you remove the following files.
      IBatisNet.Common.Logging.IDataReaderProxy.cs
      IBatisNet.Common.Logging.IDbCommandProxy.cs
      IBatisNet.Common.Logging.IDbConnectionProxy.cs

      Attachments

        Activity

          People

            Unassigned Unassigned
            nonkichi Noriyuki
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: