Пример #1
0
		public virtual bool AddBank(BankAccount bankAccount)
		{
			if (bankAccount == null)
			{
				return false;
			}

			if (this.bankAccounts.Add(bankAccount))
			{
				bankAccount.Company = this;
				return true;
			}
			return false;
		}
Пример #2
0
		private Guid CreateScenario()
		{
			var company = new Company() {Name = "Company test"};
			var address = new Address() {Name = "Address test"};
			var bankAccount = new BankAccount() {Name = "Bank test"};
			company.AddAddress(address);
			company.AddBank(bankAccount);
			using (ISession session = sessions.OpenSession())
			{
				using (ITransaction tx = session.BeginTransaction())
				{
					session.Persist(company);
					tx.Commit();
				}
			}
			return company.Id;
		}