Update dbcontext scope

Update dbcontext so it can be accessed in derived classes.