コード例 #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);
            }
        }
コード例 #2
0
        public AuctionInfo ListAuction(string auctionId)
        {
            TransactionalAuctionService svc = GetTransactionalAuctionService();
            AuctionInfo ai = svc.ListAuction(auctionId);

            return(ai);
        }
コード例 #3
0
        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);
            }
        }
コード例 #4
0
        protected TransactionalAuctionService GetTransactionalAuctionService()
        {
            IPersistenceFactory         persistenceFactory = GetPersistenceFactory();
            TransactionalAuctionService service            = new TransactionalAuctionService();

            service.SetPersistenceFactory(persistenceFactory);
            return(service);
        }
コード例 #5
0
 protected TransactionalAuctionService GetTransactionalAuctionService()
 {
     IPersistenceFactory persistenceFactory = GetPersistenceFactory();
     TransactionalAuctionService service =  new TransactionalAuctionService() ;
     service.SetPersistenceFactory(persistenceFactory);
     return service;
 }