Example #1
0
		public void TearDown()
		{
			container.Release(myBankA);
			container.Release(myBankB);
			myBankA=null;
			myBankB=null;

			Configuration cfg = (Configuration) container[  "nhibernate.factory.cfg" ];
			SchemaExport export = new SchemaExport(cfg);
			export.Drop(false, true);

			DisposeContainer();
		}
Example #2
0
		public void SetUp()
		{
			SetContainer();
			Configuration cfg = (Configuration) container[  "nhibernate.factory.cfg"  ];
			SchemaExport export = new SchemaExport(cfg);
			export.Create(false, true);

// It is not possible to add the transaction component here! See http://forum.castleproject.org/posts/list/455.page		
//			container.AddFacility( "transactions", new TransactionFacility() );

			myBankA = (IBankA) container["BankA"];
			myBankB = (IBankB) container["BankB"];
		}
Example #3
0
        public void TearDown()
        {
            container.Release(myBankA);
            container.Release(myBankB);
            myBankA = null;
            myBankB = null;

            Configuration cfg    = (Configuration)container["nhibernate.factory.cfg"];
            SchemaExport  export = new SchemaExport(cfg);

            export.Drop(false, true);

            DisposeContainer();
        }
Example #4
0
        public void SetUp()
        {
            SetContainer();
            Configuration cfg    = (Configuration)container["nhibernate.factory.cfg"];
            SchemaExport  export = new SchemaExport(cfg);

            export.Create(false, true);

// It is not possible to add the transaction component here! See http://forum.castleproject.org/posts/list/455.page
//			container.AddFacility( "transactions", new TransactionFacility() );

            myBankA = (IBankA)container["BankA"];
            myBankB = (IBankB)container["BankB"];
        }
Example #5
0
		public virtual void TransferMoney(string name,float money,IBankB bank)
		{
			DbSession dbSession = null;
			try
			{
				dbSession = OpenSession();
				instance.Withdraw(GetName(),name,money,dbSession);
				bank.DeposidMoney(name,money);
				// Ohhhh I forgot the rules ;-)
				if (money>10)
				{
					throw new AccountException("it is not allowed to transfer more then 10!");
				}
			}
			finally
			{
				if (dbSession!=null)
				{
					dbSession.Close();
				}
			}
		}
Example #6
0
        public virtual void TransferMoney(string name, float money, IBankB bank)
        {
            DbSession dbSession = null;

            try
            {
                dbSession = OpenSession();
                instance.Withdraw(GetName(), name, money, dbSession);
                bank.DeposidMoney(name, money);
                // Ohhhh I forgot the rules ;-)
                if (money > 10)
                {
                    throw new AccountException("it is not allowed to transfer more then 10!");
                }
            }
            finally
            {
                if (dbSession != null)
                {
                    dbSession.Close();
                }
            }
        }