|
@@ -14,11 +14,12 @@ namespace DW5S.Repostory
|
|
|
}
|
|
|
public class UnitOfWork : IUnitOfWork
|
|
|
{
|
|
|
- private readonly OracleContext ctx;
|
|
|
+ public readonly OracleContext ctx;
|
|
|
|
|
|
public IRepository<TEntity> Of<TEntity>() where TEntity : BaseEntity
|
|
|
{
|
|
|
- var reps = IocContainer.GetService<IRepository<TEntity>>();
|
|
|
+ //UnitOfWork中的DbContext必须和Repository中的DbContext是同一个对象
|
|
|
+ var reps = IocContainer.GetService<IRepository<TEntity>>(ctx);
|
|
|
return reps;
|
|
|
}
|
|
|
|