EF4 Code First, TDD, CRUD, and Transactions
问题 In the past, I've written unit tests for simple CRUD operations when creating data access/repository code that look something like this: using(var connection = new WhateverConnection(connectionString)) { connection.Open(); using(var transaction = connection.BeginTransaction()) { try { //test the CRUD operation } finally { //gets rid of any stuff created during the test transaction.Rollback(); } } } I was messing around with EF4 Code First today, and I realized that I have no idea how this