Yes it is possible . check the solution bellow
Ninject DI Configuration
kernel.Bind<MyDbContext>().ToSelf().InRequestScope();
kernel.Bind<IUnitOfWork<MyDbContext>>().To<UnitOfWork<MyDbContext>>();
kernel.Bind<IEmployeeRepository>().To<EmployeeRepository>();
And within UnitOfWork
public class UnitOfWork<C> : IUnitOfWork<C> where C : DbContext
{
private readonly C _dbcontext;
public UnitOfWork(C dbcontext)
{
_dbcontext = dbcontext;
}
public int Commit()
{
return _dbcontext.SaveChanges();
}
public C GetContext
{
get
{
return _dbcontext;
}
}
[...]