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(); } }
public InvoiceItem(Product product, decimal quantity) { this.Product = product; this.Quantity = quantity; }
public bool Equals(Product other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; return other._Id == _Id; }