Exemplo n.º 1
0
		private void IdBagWithCompositeElementThatContainsAManyToOne_Setup()
		{
			using (ISession s = OpenSession())
			{
				product1 = new Product("Star Wars DVD");
				product2 = new Product("100TB Hard Drive");
				product3 = new Product("Something else");

				s.Save(product1);
				s.Save(product2);
				s.Save(product3);

				inv = new Invoice();
				inv.Number = "123";
				inv.Items.Add(new InvoiceItem(product1, 1));
				inv.Items.Add(new InvoiceItem(product2, 1));

				s.Save(inv);

				s.Flush();
			}
		}
Exemplo n.º 2
0
		public InvoiceItem(Product product, decimal quantity)
		{
			this.Product = product;
			this.Quantity = quantity;
		}
Exemplo n.º 3
0
		public bool Equals(Product other)
		{
			if (ReferenceEquals(null, other)) return false;
			if (ReferenceEquals(this, other)) return true;
			return other._Id == _Id;
		}