我有一个UoW类,它具有启动和提交如下 public class uow
{
private IDBcontext mydbcontext;
TransactionScope trans = null;
public uow(IDBConext mydbcontext)
{
this.mydbcontext = mydbcontext;
public void Operation01()
{
//Some Data manipulation here.
this.UnitOfWork.Commit();
}
public void Operation02()
{
Operation01();
//Some db work here
//Some ERROR Occur
其实我正在与Linq和UOW(工作单元)合作,并且我正在用linq轻松访问bbdd。我知道,如果我要得到一个表格的第一行,我可以这样做: int test4 = (from p
in uow.ProductR.context.product
where p.Id == 1715 select p.Id).FirstOrDefault();
这将在SQL Server
我的dropwizard应用程序有一个集成测试,我使用hibernate h2数据库来存储数据。对于测试的第二部分,我使用jersey-testframework来处理资源和休息调用。 为了使这两个部分一起工作,我必须为每个案例创建一个TestRule。 休眠: @ClassRule
public static final SessionFactoryRule sessionFactoryRul
下面的代码似乎使用这个工作: var unitOfWorkProvider = new PetaPocoUnitOfWorkProvider();
var repository = new FakeRepository();
var fake = new Fake
{
// etc.
};
using (var uow = unitOfWorkProvider.GetUni
我尝试插入的对象与genericrepository: 我有这样的: GenericRepository: public class GenericRepository<TEntity> where TEntity : class
{
internal LolaBikeContext context;
internal DbSet<TEntity> dbSet;