/// <summary>
        /// Register a DaoManager
        /// </summary>
        /// <param name="contextName"></param>
        /// <param name="daoManager"></param>
        internal static void RegisterDaoManager(string contextName, DaoManager daoManager)
        {
            if (DaoContextMap.Contains(contextName))
            {
                throw new DataAccessException("There is already a DAO Context with the ID '" + contextName + "'.");
            }
            DaoContextMap.Add(contextName, daoManager);

            if (daoManager.IsDefault == true)
            {
                if (DaoContextMap[DEFAULT_CONTEXT_NAME] == null)
                {
                    DaoContextMap.Add(DEFAULT_CONTEXT_NAME, daoManager);
                }
                else
                {
                    throw new DataAccessException("Error while configuring DaoManager.  There can be only one default DAO context.");
                }
            }
        }
예제 #2
0
 /// <summary>
 /// The DaoManager that manages this Dao instance will be passed
 /// in as the parameter to this constructor automatically upon
 /// instantiation.
 /// </summary>
 /// <param name="daoManager"></param>
 public DaoSession(DaoManager daoManager)
 {
     this.daoManager = daoManager;
 }