Which version do you use ? in which context web,  window ?

On 4/27/06, Shawn Hinsey <[EMAIL PROTECTED]> wrote:
Hello,

I have the following base class that all of my domain objects use to
grab references to the appropriate DAO.

A couple of common usages:

BookCollection myBooks = Book.Load();

Book myBook = new Book();
myBook.Title = "A Tale of Two Cities";
myBook.Save();

       public class DomainBase
       {
               static DomainBase()
               {
                       _builder = new DomDaoManagerBuilder();
                       _builder.Configure();
                       _manager = DaoManager.GetInstance ("SqlMapDao");
               }

               protected static DaoManager _manager;

               protected static DomDaoManagerBuilder _builder;

               public static T GetDao<T>()
               {
                       try
                       {
                               return (T)_manager.GetDao(typeof(T));
                       }
                       catch (Exception ex)
                       {
                               throw ex;
                       }
               }
       }

The problem I'm running into is that when I invoke GetDao from an
AsyncCallback delegate, I run into this exception:

IBatisNet.DataAccess.Exceptions.DataAccessException: There is already a
DAO Context with the ID 'SqlMapDao'.

What am I missing in order to make this thread-safe?


Reply via email to