public void TestStoreBrand() { using (TransactionScope ts = new TransactionScope()) using (CarsContext context = new CarsContext()) { Brand volvo = new Brand { Name = "Volvo" }; context.Brands.Add(volvo); context.SaveChanges(); } }
public void TestStoreCar() { using (TransactionScope ts = new TransactionScope()) using (CarsContext context = new CarsContext()) { Brand volvo = new Brand { Name = "Volvo" }; Car myVolvo = new Car { Brand = volvo, RegistrationNumber = "ABC123" }; context.Cars.Add(myVolvo); context.SaveChanges(); } }