Пример #1
0
        /// <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>
 /// Initialize dao object.
 /// </summary>
 public void Initialize(DaoManager daoManager)
 {
     try
     {
         _daoManager = daoManager;
         _daoImplementation = TypeUtils.ResolveType(this.Implementation);
         _daoInterface = TypeUtils.ResolveType(this.Interface);
         // Create a new instance of the Dao object.
         _daoInstance = _daoImplementation.GetConstructor(Type.EmptyTypes).Invoke(null) as IDao;
         _proxy = DaoProxy.NewInstance(this);
     }
     catch(Exception e)
     {
         throw new ConfigurationException(string.Format("Error configuring DAO. Cause: {0}", e.Message), e);
     }
 }
Пример #3
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;
 }
Пример #4
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;
 }
Пример #5
0
        /// <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.");
                }
            }
        }