Пример #1
0
		public virtual bool RemoveAddress(Address address)
		{
			if (address == null)
			{
				return false;
			}
			if (this.addresses.Remove(address))
			{
				address.RemoveCompany();
				return true;
			}
			return false;
		}
Пример #2
0
		public virtual bool AddAddress(Address address)
		{
			if (address == null)
			{
				return false;
			}

			if (this.addresses.Add(address))
			{
				address.AddCompany(this);
				return true;
			}
			return false;
		}
Пример #3
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;
		}