Example #1
0
        public override List <EntityState> GetAll(Type entityType)
        {
            OracleConnection connection = GetConnection();

            try
            {
                connection.Open();

                IEntityBroker broker = GetBroker(entityType);

                List <Entity> entities = broker.GetAll(connection);

                foreach (var entity in entities)
                {
                    eStates.Add(new EntityState(entity, State.UNCHANGED));
                }

                return(eStates);
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                connection.Close();
            }
        }
Example #2
0
        public override Entity Get(long id, Type entityType)
        {
            foreach (var es in eStates)
            {
                if (es.Entity.ID == id)
                {
                    return(es.Entity);
                }
            }

            OracleConnection connection = GetConnection();

            try
            {
                connection.Open();

                IEntityBroker broker = GetBroker(entityType);

                Entity entity = broker.Get(id, connection);

                eStates.Add(new EntityState(entity, State.UNCHANGED));

                return(entity);
            }
            finally
            {
                connection?.Close();
            }
        }
Example #3
0
        private void InsertImpl(IEnumerable <Entity> entities, OracleConnection connection, OracleTransaction transaction)
        {
            foreach (var entity in entities)
            {
                IEntityBroker broker = GetBroker(entity.GetType());

                broker.Insert(entity, connection, transaction);
            }
        }
Example #4
0
        private void UpdateOne(Entity entity, OracleConnection connection, OracleTransaction transaction)
        {
            IEntityBroker broker = GetBroker(entity.GetType());

            broker.Update(entity, connection, transaction);
        }