Gilles,
Sorry for leaving that out. I'm using 1.3 DataMapper and
1.7 DataAccess from the context of a console application. Eventually it'll be
running as a Windows Service, but I don't think that should make a
difference.
To give a bit more insight into how the app
works:
I'm creating an HttpWebRequest and attaching a method to
its BeginRequest handler via an AsyncCallback delegate. The delegate's
implementation creates a new instance of a class that implements the DomainBase
class, which is below.
Thanks,
Shawn
From: Gilles Bayon [mailto:[EMAIL PROTECTED]
Sent: Thursday, April 27, 2006 2:06 PM
To: [email protected]
Subject: Re: async access to DaoManager
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?

