private static void InsertExpensive() { var item = new ExpenseLineItem { Amount = 3000, Description = "Expensive Item" }; var expense = new Expense { Description = "Expensive Description", Title = "Expensive Title" }; expense.AddLineItem(item); using (var uow = new UnitOfWork()) { var repository = uow.GetRepository<ExpenseRepository>(); repository.Save(expense); uow.Commit(); } }
private static void InsertWithItems() { var item1 = new ExpenseLineItem { Amount = 10, Description = "Item 1" }; var item2 = new ExpenseLineItem { Amount = 300, Description = "Item 2" }; var expense = new Expense { Description = "Expense", Title = "Title" }; expense.AddLineItem(item1); expense.AddLineItem(item2); using (var uow = new UnitOfWork()) { var repository = uow.GetRepository<ExpenseRepository>(); repository.Save(expense); uow.Commit(); } }