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(); }
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"]; }
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(); }
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"]; }
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(); } } }
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(); } } }