Пример #1
0
        public AuctionInfo ListAuctionTwiceWithTransaction(String auctionId)
        {
            try
            {
                TransactionalAuctionService service = new TransactionalAuctionService();
                service.SetPersistenceFactory(this.persistenceFactory);
                AuctionInfo ai = service.ListAuction(auctionId);

                string sql = ai.Sql;

                service = new TransactionalAuctionService();
                service.SetPersistenceFactory(this.persistenceFactory);
                ai = service.ListAuction(auctionId);

                ai.Sql = sql + ai.Sql;

                return(ai);
            }
            catch (Exception e)
            {
                // The next operation is for Object-Relational mapping software that needs to be explicitly cleaned up.
                // Those that do not simply ignore this operation.
                if (persistentAuctions != null)
                {
                    persistentAuctions.Close();
                }
                throw new AuctionServiceException(e);
            }
        }
        public AuctionInfo ListAuctionTwiceWithoutTransaction(String auctionId)
        {
            try
            {
                TransactionalAuctionService service = new TransactionalAuctionService();
                service.SetPersistenceFactory(this.persistenceFactory);
                AuctionInfo ai = service.ListAuction(auctionId);

                string sql = ai.Sql;

                service = new TransactionalAuctionService();
                service.SetPersistenceFactory(this.persistenceFactory);
                ai = service.ListAuction(auctionId);

                ai.Sql = sql + ai.Sql;

                return ai;
            }
            catch (Exception e)
            {
                // The next operation is for Object-Relational mapping software that needs to be explicitly cleaned up.
                // Those that do not simply ignore this operation.
                if (persistentAuctions!=null) persistentAuctions.Close();
                throw new AuctionServiceException(e);
            }
        }
        protected TransactionalAuctionService GetTransactionalAuctionService()
        {
            IPersistenceFactory         persistenceFactory = GetPersistenceFactory();
            TransactionalAuctionService service            = new TransactionalAuctionService();

            service.SetPersistenceFactory(persistenceFactory);
            return(service);
        }
 protected TransactionalAuctionService GetTransactionalAuctionService()
 {
     IPersistenceFactory persistenceFactory = GetPersistenceFactory();
     TransactionalAuctionService service =  new TransactionalAuctionService() ;
     service.SetPersistenceFactory(persistenceFactory);
     return service;
 }