/// <summary>
 /// Construtor padrão.
 /// </summary>
 /// <param name="owner">Instancia da sessão de persistencia pai.</param>
 /// <param name="parent">Instancia da lista pai.</param>
 public AggregatePersistenceSession(PersistenceSession owner, List <PersistenceAction> parent)
 {
     owner.Require("owner").NotNull();
     parent.Require("parent").NotNull();
     _owner  = owner;
     _parent = parent;
 }
示例#2
0
        public virtual Void execute(CommandContext commandContext)
        {
            string             databaseSchemaUpdate = Context.ProcessEngineConfiguration.DatabaseSchemaUpdate;
            PersistenceSession persistenceSession   = commandContext.getSession(typeof(PersistenceSession));

            if (ProcessEngineConfigurationImpl.DB_SCHEMA_UPDATE_DROP_CREATE.Equals(databaseSchemaUpdate))
            {
                try
                {
                    persistenceSession.dbSchemaDrop();
                }
                catch (Exception)
                {
                    // ignore
                }
            }
            if (ProcessEngineConfiguration.DB_SCHEMA_UPDATE_CREATE_DROP.Equals(databaseSchemaUpdate) || ProcessEngineConfigurationImpl.DB_SCHEMA_UPDATE_DROP_CREATE.Equals(databaseSchemaUpdate) || ProcessEngineConfigurationImpl.DB_SCHEMA_UPDATE_CREATE.Equals(databaseSchemaUpdate))
            {
                persistenceSession.dbSchemaCreate();
            }
            else if (ProcessEngineConfiguration.DB_SCHEMA_UPDATE_FALSE.Equals(databaseSchemaUpdate))
            {
                persistenceSession.dbSchemaCheckVersion();
            }
            else if (ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE.Equals(databaseSchemaUpdate))
            {
                persistenceSession.dbSchemaUpdate();
            }

            return(null);
        }
示例#3
0
            public object execute(CommandContext commandContext)
            {
                PersistenceSession persistenceSession = commandContext.getSession(typeof(PersistenceSession));

                persistenceSession.dbSchemaDrop();
                persistenceSession.dbSchemaCreate();
                HistoryLevelSetupCommand.dbCreateHistoryLevel(commandContext);
                return(null);
            }
示例#4
0
 public DbEntityManager(IdGenerator idGenerator, PersistenceSession persistenceSession)
 {
     this.idGenerator        = idGenerator;
     this.persistenceSession = persistenceSession;
     if (persistenceSession != null)
     {
         this.persistenceSession.addEntityLoadListener(this);
     }
     initializeEntityCache();
     initializeOperationManager();
 }
示例#5
0
        /// <summary>
        /// Realiza a validaçao da sessão informada.
        /// </summary>
        /// <param name="session"></param>
        /// <returns></returns>
        public PersistenceSessionValidateResult Validate(PersistenceSession session)
        {
            var state  = new ValidationState(this);
            var result = new PersistenceSessionValidateResult();

            foreach (var action in session)
            {
                NavigatePersistenceAction(action, state, result);
            }
            return(result);
        }
        /// <summary>
        /// Realiza a validação da sessão de persistencia informada.
        /// </summary>
        /// <param name="session"></param>
        /// <returns></returns>
        public PersistenceSessionValidateResult Validate(PersistenceSession session)
        {
            PersistenceSessionValidateResult result = null;

            foreach (var validator in _validators)
            {
                result = validator.Validate(session);
                if (!result.Success)
                {
                    break;
                }
            }
            return(result);
        }
示例#7
0
        public void LogOut()
        {
            if (null != UserSession)
            {
                using (ITransaction tx = PersistenceSession.BeginTransaction())
                {
                    try
                    {
                        UserSession.SessionPeriod.To = DateTime.Now;
                        UserSession.LogoutMessage    = "Logout";
                        UserSession.Save(this);

                        tx.Commit();
                    }
                    catch (Exception)
                    {
                        tx.Rollback();
                        throw;
                    }
                }
            }
        }
        public void LogOut(int pageId = 0)
        {
            if (null != UserSession)
            {
                using (ITransaction tx = PersistenceSession.BeginTransaction())
                {
                    try
                    {
                        UserSession.SessionPeriod.To = DateTime.Now;
                        UserSession.LogoutMessage    = "Logout";
                        UserSession.Save(this);

                        Log(0, pageId, 0, MessageException.AuthenMessage.Logout, MessageException.Success(User.ID.ToString()));
                        tx.Commit();
                    }
                    catch (Exception ex)
                    {
                        Log(0, pageId, 0, MessageException.AuthenMessage.Logout, MessageException.Fail(ex.Message));
                        throw;
                    }
                }
            }
        }
示例#9
0
 public ExposingDbEntityManager(IdGenerator idGenerator, PersistenceSession persistenceSession) : base(idGenerator, persistenceSession)
 {
 }
示例#10
0
        public virtual DbEntityManager openSession()
        {
            PersistenceSession persistenceSession = Context.CommandContext.getSession(typeof(PersistenceSession));

            return(new DbEntityManager(idGenerator, persistenceSession));
        }