public void Read_and_write_using_MonsterModel_created_from_T4_template() { int orderId; int? customerId; using (var context = new MonsterModel()) { var entry = context.Entry(CreateOrder()); entry.State = EntityState.Added; context.SaveChanges(); orderId = entry.Entity.OrderId; customerId = entry.Entity.CustomerId; } using (var context = new MonsterModel()) { var order = context.Order.Include(o => o.Customer).Single(o => o.CustomerId == customerId); Assert.Equal(orderId, order.OrderId); Assert.True(order.Customer.Orders.Contains(order)); } }
public void Read_and_write_using_MonsterModel_created_from_T4_template() { int orderId; int? customerId; ExtendedSqlAzureExecutionStrategy.ExecuteNew( () => { using (new TransactionScope()) { using (var context = new MonsterModel()) { var entry = context.Entry(CreateOrder()); entry.State = EntityState.Added; context.SaveChanges(); orderId = entry.Entity.OrderId; customerId = entry.Entity.CustomerId; } using (var context = new MonsterModel()) { var order = context.Order.Include(o => o.Customer).Single(o => o.CustomerId == customerId); Assert.Equal(orderId, order.OrderId); Assert.True(order.Customer.Orders.Contains(order)); } } }); }